set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_SOURCE_DIR}/lib") set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG "${PROJECT_SOURCE_DIR}/lib") set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE "${PROJECT_SOURCE_DIR}/lib") 其中的路径变量PROJECT_SOURCE_DIR是 CMake 的内置变量,代表项目的根目录,也就是最近一...
PROJECT_HOMEPAGE_URL: 项目的主页URL。 PROJECT_SOURCE_DIR: 项目的顶层源目录。 PROJECT_BINARY_DIR: 项目的顶层构建目录。 例如,可以这样使用它: project(MyProjectVERSION1.0.0)message("Project name: ${PROJECT_NAME}")message("Version: ${PROJECT_VERSION}") 4. set_property() set_property是CMake中的...
CMakeLists常用指令 #指定cmake最低版本cmake_minimum_required(VERSION3.10.2)#指定工程名字和支持的语言project(testLANGUAGES CXX)#指定cmake模块路径set(CMAKE_MODULE_PATH"${CMAKE_SOURCE_DIR}/cmake")# 配置最终的可执行文件输出的路径set(EXECUTABLE_OUTPUT_PATH${PROJECT_SOURCE_DIR}/bin)#指定C++标准set(...
# ${PROJECT_SOURCE_DIR} 和 <PROJECT-NAME>_SOURCE_DIR:本CMakeLists.txt所在的文件夹路径 # ${PROJECT_NAME}:本CMakeLists.txt的project名称 project(xxx) project(mytest VERSION 1.2.3.4) project (mytest HOMEPAGE_URL “https://www.XXX(示例).com”) # 获取路径下所有的.cpp/.c/.cc文件(不包括...
message("~~~ CMAKE_SOURCE_DIR: ${CMAKE_SOURCE_DIR}") # C:/_cpp/hello_cpp message("~~~ CMAKE_MODULE_PATC: ${CMAKE_MODULE_PATH}") # 空 message("~~~ PROJECT_SOURCE_DIR: ${PROJECT_SOURCE_DIR}") # C:/_cpp/hello_cpp message("...
set(PROJECT_SOURCES main.cpp pj.cpp pj.h pj.ui qrc.qrc ) # 包含源文件目录 优化项目 大佬添加 INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}) # **创建可执行文件 # 如果Qt的主要版本号大于等于6,则使用"qt_add_executable"来创建可执行文件。否则,根据目标平台选择创建动态库(Android)或可执行文件。
add_subdirectory(source_dir [binary_dir] [EXCLUDE_FROM_ALL]) find_package:查找并加载指定的包。 ```cmakefind_package(PackageName [REQUIRED] [NO_MODULE] [NO_POLICY_SCOPE] [NO_CMAKE_FIND_ROOT_PATH] [NO_CMAKE_SYSTEM_PATH] [NO_CMAKE_ENVIRONMENT_PATH] [NO_CMAKE_PATH] [NO_CMAKE_SYSTEM...
PROJECT_SOURCE_DIR: 工程的根目录 PROJECT_BINARY_DIR: 执行cmake命令的目录,如果mkdir build ,cd build, cmake ../,的话,该变量的值为build目录 CMAKE_CURRENT_SOURCE_DIR:当前处理的CMakeLists.txt文件所在目录 CMAKE_CURRENT_BINARY_DIR: cmake当前正在处理的二进制目录 ...
${PROJECT_SOURCE_DIR}/lib/libCommonUtilities.so ${PROJECT_SOURCE_DIR}/lib/libInuStreams.so ) 1. 2. 3. 4. 5. 6. 7. 8. 9. CMakeLists生成和添加依赖库 Opencv依赖库的添加: cmake_minimum_required( VERSION2.8 ) project( imageBasics ) ...
project (Tutorial) # The version number. set (Tutorial_VERSION_MAJOR 1) set (Tutorial_VERSION_MINOR 0) # configure a header file to pass some of the CMake settings # to the source code configure_file ( "${PROJECT_SOURCE_DIR}/TutorialConfig.h.in" ...