CMakeLists.txt 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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 imported::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)
  21. add_library(iface_imported INTERFACE IMPORTED)
  22. set_property(TARGET iface_imported PROPERTY
  23. INTERFACE_COMPILE_DEFINITIONS
  24. $<$<CONFIG:SPECIAL>:SPECIAL_MODE>
  25. $<$<CONFIG:Debug>:DEBUG_MODE>
  26. )
  27. set_property(TARGET iface_imported PROPERTY
  28. MAP_IMPORTED_CONFIG_DEBUG SPECIAL
  29. )
  30. add_executable(map_config map_config.cpp)
  31. target_link_libraries(map_config iface_imported)