「CMake - インクルード」の版間の差分

ナビゲーションに移動 検索に移動
38行目: 38行目:
     ${<任意の変数名>_CFLAGS_OTHER}
     ${<任意の変数名>_CFLAGS_OTHER}
  )
  )
</syntaxhighlight>
<br><br>
== インクルードパスの指定 ==
インクルードパスを指定する場合、<code>include_directories</code>コマンドを使用する。<br>
<syntaxhighlight lang="cmake">
include_directories(/path/to/include)
</syntaxhighlight>
<br>
<code>include_directories</code>コマンドを複数使用する場合、デフォルトでは、指定したパスは最後尾となる。<br>
ただし、<code>include_directories</code>コマンドに<code>BEFORE</code>オプションを付加した場合は最前となる。<br>
<br>
以下の例では、"-I/path1/to/include -I/path2/to/include"となる。<br>
<syntaxhighlight lang="cmake">
include_directories(/path1/to/include)
include_directories(/path2/to/include)
</syntaxhighlight>
<br>
以下の例では、"-I/path2/to/include -I/path1/to/include" となる。<br>
<syntaxhighlight lang="cmake">
include_directories(/path1/to/include)
include_directories(BEFORE /path2/to/include)
  </syntaxhighlight>
  </syntaxhighlight>
<br><br>
<br><br>

案内メニュー