CMakeLists.txt文件写法(12):查找特定软件的安装目录
来源:互联网 发布:mac 调出控制台 编辑:程序博客网 时间:2024/05/16 04:54
例如:
#Wx可能安装的目录(注意斜线的方向)
SET(DirectorOfWxMyBe c:/
d:/
c:/wx
d:/wx)
#能代表WxWindows特征的文件
SET(CharacteristicFilesOfWx aclocal.m4
autoconf_inc.m4
autogen.sh
BuildCVS.txt
config.guess
config.sub
configure
configure.in
install-cocoa.txt
install-dfb.txt
install-gtk.txt
install-mac.txt
install-mgl.txt
install-motif.txt
INSTALL-MSW.txt
INSTALL-OS2.txt
install-sh
install-x11.txt
Makefile.in
mkinstalldirs
readme-cocoa.txt
readme-gtk.txt
readme-mac.txt
readme-mgl.txt
readme-motif.txt
README-MSW.txt
readme-x11.txt
regen
setup.h.in
version-script.in
wx-config-inplace.in
wx-config.in
wxBase.spec
wxGTK.spec
wxMGL.spec
wxMotif.spec
wxwin.m4
wxX11.spec)
#WxWindows的安装目录
FIND_PATH(WxRoot NAMES ${CharacteristicFilesOfWx} PATHS ${DirectorOfWxMyBe})
MESSAGE(${WxRoot})
FIND_PATH: Find the directory containing a file.
FIND_PATH(<VAR> name1 path1 path2 ...)
This is the short-hand signature for the command that is sufficient in many cases. It is the same as FIND_PATH(<VAR> name1 PATHS path2 path2 ...)
FIND_PATH(
<VAR>
name | NAMES name1 [name2 ...]
PATHS path1 [path2 ... ENV var]
[PATH_SUFFIXES suffix1 [suffix2 ...]]
[DOC "cache documentation string"]
[NO_DEFAULT_PATH]
[NO_CMAKE_ENVIRONMENT_PATH]
[NO_CMAKE_PATH]
[NO_SYSTEM_ENVIRONMENT_PATH]
[NO_CMAKE_SYSTEM_PATH]
)
This command is used to find a directory containing the named file. A cache entry named by <VAR> is created to store the result of this command. If the file in a directory is found the result is stored in the variable and the search will not be repeated unless the variable is cleared. If nothing is found, the result will be <VAR>-NOTFOUND, and the search will be attempted again the next time FIND_PATH is invoked with the same variable. The name of the file in a directory that is searched for is specified by the names listed after the NAMES argument. Additional search locations can be specified after the PATHS argument. If ENV var is found in the PATHS section the environment variable var will be read and converted from a system environment variable to a cmake style list of paths. For example ENV PATH would be a way to list the system path variable. The argument after DOC will be used for the documentation string in the cache. PATH_SUFFIXES can be used to give sub directories that will be appended to the search paths.
If NO_DEFAULT_PATH is specified, then no additional paths are added to the search. If NO_DEFAULT_PATH is not specified, the search process is as follows:
1. Search cmake specific environment variables. This can be skipped if NO_CMAKE_ENVIRONMENT_PATH is passed.
CMAKE_FRAMEWORK_PATH
CMAKE_APPBUNDLE_PATH
CMAKE_INCLUDE_PATH
2. Search cmake variables with the same names as the cmake specific environment variables. These are intended to be used on the command line with a -DVAR=value. This can be skipped if NO_CMAKE_PATH is passed.
CMAKE_FRAMEWORK_PATH
CMAKE_APPBUNDLE_PATH
CMAKE_INCLUDE_PATH
3. Search the standard system environment variables. This can be skipped if NO_SYSTEM_ENVIRONMENT_PATH is an argument.
PATH
INCLUDE
4. Search cmake variables defined in the Platform files for the current system. This can be skipped if NO_CMAKE_SYSTEM_PATH is passed.
CMAKE_SYSTEM_FRAMEWORK_PATH
CMAKE_SYSTEM_APPBUNDLE_PATH
CMAKE_SYSTEM_INCLUDE_PATH
5. Search the paths specified after PATHS or in the short-hand version of the command.
On Darwin or systems supporting OSX Frameworks, the cmake variable CMAKE_FIND_FRAMEWORK can be set to empty or one of the following:
"FIRST" - Try to find frameworks before standard
libraries or headers. This is the default on Darwin.
"LAST" - Try to find frameworks after standard
libraries or headers.
"ONLY" - Only try to find frameworks.
"NEVER". - Never try to find frameworks.
On Darwin or systems supporting OSX Application Bundles, the cmake variable CMAKE_FIND_APPBUNDLE can be set to empty or one of the following:
"FIRST" - Try to find application bundles before standard
programs. This is the default on Darwin.
"LAST" - Try to find application bundles after standard
programs.
"ONLY" - Only try to find application bundles.
"NEVER". - Never try to find application bundles.
The reason the paths listed in the call to the command are searched last is that most users of CMake would expect things to be found first in the locations specified by their environment. Projects may override this behavior by simply calling the command twice:
FIND_PATH(<VAR> NAMES name PATHS paths NO_DEFAULT_PATH)
FIND_PATH(<VAR> NAMES name)
Once one of these calls succeeds the result variable will be set and stored in the cache so that neither call will search again.
When searching for frameworks, if the file is specified as A/b.h, then the framework search will look for A.framework/Headers/b.h. If that is found the path will be set to the path to the framework. CMake will convert this to the correct -F option to include the file.
- CMakeLists.txt文件写法(12):查找特定软件的安装目录
- CMakeLists.txt文件写法
- CMakeLists.txt文件写法
- CMakeLists.txt的写法
- CMakeLists.txt的写法
- CMakeLists.txt的写法
- CMakeLists.txt的写法
- CMakeLists.txt的写法
- CMakeLists.txt的写法
- CMakeLists.txt文件写法(7):添加查找头文件的路径
- CMakeLists.txt文件写法(0):选择合适的文件编辑器
- CMakeLists.txt文件写法(4):使用变量
- 简单的CMakeLists.txt文件
- 通用的 cmakeLists.txt 文件
- CMakeLists.txt文件写法(6):要求CMake根据指定的源文件生成库文件
- CMakeLists.txt文件写法(8):添加库文件的搜索路径
- CMakeLists.txt文件写法(9):显式指定链接时需要的库文件
- CMakeLists.txt文件写法(1):要求CMake根据指定的源文件生成可执行文件
- 搞笑网络
- jQuery - 参考资料 - About Cross-Frame Scripting and Security:关于跨框架脚本和安全
- 使用 Velocity 实现客户端和服务器端模板
- div+css - CSS标准 - 8.5 Border properties边框属性
- [转帖]敏捷团队建设
- CMakeLists.txt文件写法(12):查找特定软件的安装目录
- Rational 路线图
- java对properties的操作
- se2
- Java带有ICTCLAS.dll的发布
- 巧贴扩展名受限的图片
- 题外话: 一个网络创业的论坛
- 转贴
- 理解代理模式和java中的动态代理