CMakeLists.txt 1002 B

12345678910111213141516171819202122232425262728293031
  1. cmake_minimum_required(VERSION 2.8)
  2. project(InterfaceLibrary)
  3. add_library(iface_nodepends INTERFACE)
  4. target_compile_definitions(iface_nodepends INTERFACE IFACE_DEFINE)
  5. add_subdirectory(headerdir)
  6. add_executable(InterfaceLibrary definetestexe.cpp)
  7. target_link_libraries(InterfaceLibrary iface_nodepends headeriface)
  8. add_subdirectory(libsdir)
  9. add_executable(sharedlibtestexe sharedlibtestexe.cpp)
  10. target_link_libraries(sharedlibtestexe shared_iface)
  11. add_library(broken EXCLUDE_FROM_ALL broken.cpp)
  12. add_library(iface_broken INTERFACE)
  13. # This is not a dependency, so broken will not be built (and the error in
  14. # it will not be hit)
  15. target_link_libraries(iface_broken INTERFACE broken)
  16. add_library(iface_whitelist INTERFACE)
  17. # The target property CUSTOM will never be evaluated on the INTERFACE library.
  18. target_link_libraries(iface_whitelist INTERFACE $<$<BOOL:$<TARGET_PROPERTY:CUSTOM>>:irrelevant>)
  19. add_executable(exec_whitelist dummy.cpp)
  20. target_link_libraries(exec_whitelist iface_whitelist)