aux_source_directory(. DIR_SRCS) # 添加生成可执行文件的保存目录,不会保存中间产物,如果不指定该目录则和中间产物保存在一起 set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin ) # 添加头文件 include_directories(${PROJECT_SOURCE_DIR}/include) # 这里将子目录条件到工程,并指定编译的输出产物,默认...
SET_TARGET_PROPERTIES(dllname PROPERTIES RUNTIME_OUTPUT_DIRECTORY ../bin) 4.上面两条语句分别设置了Debug版本和Release版本下库文件的后缀名 set(CMAKE_DEBUG_POSTFIX "_d") set(CMAKE_RELEASE_POSTFIX "_r") 5.设置了Debug版本和Release版本下可执行文件的后缀名 set_target_properties(${TARGET_NAME} PRO...
set(AUTHOR_NAME Farmer) set(AUTHOR "Farmer Li") set(AUTHOR Farmer\ Li) # Set list set(SLOGAN_ARR To be) # Saved as "To;be" set(SLOGAN_ARR To;be) set(SLOGAN_ARR "To;be") set(NUM 30) # Saved as string, but can compare with other number string set(FLAG ON) # Bool value 主...
-- Installing: /home/benggee/app/c-program/cmake/src/../include/config.h 这样,就将config.h安装到了include目录下了。 然后我们在src目录下的CMakeLists.txt下把include目录加到全局头文件目录中,如下: ... project(http-server VERSION 1.0 LANGUAGES C) include_directories(${CMAKE_SOURCE_DIR}/../...
一、基本指令: INCLUDE_DIRECTORIES(${includedir}) #-I。 LINK_DIRECTORIES(${libdir}) #-L CMake 2.8.0 以下的版本,加载动态链接库link_directories()时使用相对路径,链接时也使用相对路径;CMake 2.
设置INTERFACE_INCLUDE_DIRECTORIES后, 在basiccache中都不需要find_package了 set( leveldb_INCLUDE_DIR"${CMAKE_CURRENT_SOURCE_DIR}/include")set( leveldb_INCLUDE_DIRS"${CMAKE_CURRENT_SOURCE_DIR}/include")ADD_LIBRARY(leveldb STATIC IMPORTED GLOBAL)set_property(TARGET leveldb PROPERTYINTERFACE_INCLUDE_DI...
CMAKE_INCLUDE_PATH:环境变量,非cmake变量; CMAKE_LIBRARY_PATH:环境变量; CMAKE_CURRENT_SOURCE_DIR:当前处理的CMakeLists.txt文件所在路径; CMAKE_CURRENT_BINARY_DIR:target编译目录; 使用ADD_SURDIRECTORY指令可以更改该变量的值; SET(EXECUTABLE_OUTPUT_PATH < dir >) 指令不会对该变量有影响,但改变了最终...
include_directories(AFTER sub5) #可以临时改变行为,添加到列表的最后 get_property(dirs DIRECTORY ${CMAKE_SOURCE_DIR} PROPERTY INCLUDE_DIRECTORIES) message(">>> SET DEFAULT TO BEFORE, include_dirs=${dirs}") #输出>>>include_dirs=/XXX/XXX/sub3;/XXX/XXX/sub;/XXX/XXX/sub2>>>SETDEFAULTTOBEFOR...
如果你希望改变这些文件的输出路径,可以使用set命令来设置CMAKE_RUNTIME_OUTPUT_DIRECTORY、CMAKE_LIBRARY_OUTPUT_DIRECTORY和CMAKE_ARCHIVE_OUTPUT_DIRECTORY变量。 例如,如果你想将可执行文件输出到bin目录,将库文件输出到lib目录,将静态库文件输出到static_lib目录,可以在CMakeLists.txt文件中添加以下代码: set(CMAKE...
1 CMake set_target_properties and include_directories 171 CMake how to set the build directory to be different than source directory 12 Modify CMAKE_SOURCE_DIR 2 CMAKE specifying different source directories 63 CMake with subdirectories 1 set output path for cmake generated files 0...