常用命令
指定目标属性: set_target_properties
1 2 3
| add_library(example ${SOURCE_FILES})
set_target_properties(example PROPERTIES PREFIX "")
|
CMakeLists.txt
查找三方库,使用之 Dependencies.cmake
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| find_package(pybind11 CONFIG) if(NOT pybind11_FOUND) find_package(pybind11) endif()
if(pybind11_FOUND) message(STATUS "System pybind11 found") else() message(STATUS "Using third_party/pybind11.") set(pybind11_INCLUDE_DIRS ${CMAKE_CURRENT_LIST_DIR}/../third_party/pybind11/include) install(DIRECTORY ${pybind11_INCLUDE_DIRS} DESTINATION ${CMAKE_INSTALL_PREFIX} FILES_MATCHING PATTERN "*.h") endif() message(STATUS "pybind11 include dirs: " "${pybind11_INCLUDE_DIRS}") include_directories(SYSTEM ${pybind11_INCLUDE_DIRS})
|