CMake

2019-06-24  本文已影响0人  Supreme_DJK

CMakeLists编写时不分大小写

SET (LIBHELLO_SRC hello.cpp)
add_library(${PROJECT_NAME} SHARED XXX) 共享库
ADD_LIBRARY(hello STATIC ${LIBHELLO_SRC})静态库

当要生成同名的静态库和共享库,需要使用set_target_properties来避免库覆盖问题。

target_link_libraries(${PROJECT_NAME} modcomm modrlimit sync xml thread json yaml proc logger re jsoncpp base64 db cipher http core)
set_target_properties(target1 target2 ...
                        PROPERTIES prop1 value1
                        prop2 value2 ...)
execute_process(COMMAND touch test.txt
                COMMAND echo "test..."
                )
----webshell
      ---src
          1.cc
      ---include
          1.h
      main.cc
----CMakeLists.txt

link_directories(${CMAKE_CURRENT_LIST_DIR}/webshell)
只生效webshell下的main.cc

上一篇 下一篇

猜你喜欢

热点阅读