set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE "${PROJECT_SOURCE_DIR}/lib") 编译选项相关变量 见前文。 set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wall -Wextra -Wfatal-errors -Wshadow -Wno-unused-parameter -O0") set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall -Wextra ...
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE"${CMAKE_CURRENT_SOURCE_DIR}/../libtest/lib") set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG"${CMAKE_CURRENT_SOURCE_DIR}/../libtest/libd") set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE"${CMAKE_CURRENT_SOURCE_DIR}/../libtest/lib") add_library(libtest...
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/Lib) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/Bin) set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/Lib) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/Lib) set(CMAKE_RUNTIM...
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG "${PROJECT_SOURCE_DIR}/lib") set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE "${PROJECT_SOURCE_DIR}/lib") set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_SOURCE_DIR}/lib") set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG "${PROJECT_SOURCE_DIR}/lib") set(CMAKE...
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/../bin) 1. 3.动态库输出路径(注意这个放在最后): SET_TARGET_PROPERTIES(dllname PROPERTIES RUNTIME_OUTPUT_DIRECTORY ../bin) 1. 4.上面两条语句分别设置了Debug版本和Release版本下库文件的后缀名 ...
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/libs/debug) set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/libs/release) # 创建库 add_library(mylib STATIC src/mylib.cpp) # 设置目标属性,确保生效 set_target_properties(mylib PROPERTIES ...
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}) 虽然之前的命令固定了构建输出在构建目录内的位置,但以下命令需要固定可执行文件、库和包含文件在安装前缀内的位置。这些将大致遵循相同...
LIBRARY_OUTPUT_DIR,BINARY_OUTPUT_DIR:库和可执行的最终存放目录 PROJECT_NAME,CMAKE_PROJECT_NAME:前者是当前CMakeList.txt里设置的project_name,后者是整个项目配置的project_name 四、cmake中调用环境变量 1. Using $ENV{NAME} : 调用系统环境变量,我们也可以使用 "SET(ENV{NAME} value)". 需要注意的是这里...
#aux_source_directory(src sources) # Creates and names a library, sets it as either STATIC # or SHARED, and provides the relative paths to its source code. # You can define multiple libraries, and CMake builds them for you. # Gradle automatically packages shared libraries with your APK. ...