Advertisement
Guest User

Untitled

a guest
Feb 17th, 2017
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
CMake 0.93 KB | None | 0 0
  1. #############################
  2. # CMakeLists.txt in dir A
  3. #############################
  4. set(CMAKE_INCLUDE_CURRENT_DIR ON)
  5.  
  6. set(SOURCES ...)
  7. set(HEADERS ...)
  8. set(LIBS ...) # other libs used for the project
  9.  
  10. find_package(B) # suppose FindB.cmake is provided
  11. if (B_FOUND)
  12.     include_directories(${B_INCLUDE_DIR})
  13.     list(APPEND LIBS ${B_LIBRARIES})
  14. else ()
  15.     add_subdirectory(B)
  16.     list(APPEND LIBS LocalB) # see CMakeLists.txt inside subdir B
  17. endif ()
  18.  
  19. add_definitions(-DB_STATIC) # should I do this here?
  20.  
  21. add_executable(myexe ${HEADERS} ${SOURCES})
  22. target_link_libraries(myexe ${LIBS}) # should it be just like this?
  23.  
  24. #############################
  25. # CMakeLists.txt in subdir B
  26. #############################
  27. set(CMAKE_INCLUDE_CURRENT_DIR ON)
  28.  
  29. set(SOURCES ...)
  30. set(HEADERS ...)
  31.  
  32. add_definitions(-DB_STATIC) # should I do this here?
  33.  
  34. add_library(LocalB STATIC ${SOURCES} ${HEADERS}) # should it be STATIC or not?
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement