CMakeLists.txt 731 B

123456789101112131415161718192021
  1. cmake_minimum_required (VERSION 2.7.20090711)
  2. project(Import C CXX)
  3. # Import everything in a subdirectory.
  4. add_subdirectory(A)
  5. # Make sure the imported targets are scoped inside the subdirectory.
  6. if(TARGET exp_testLib2)
  7. message(FATAL_ERROR "Imported target exp_testLib2 is not scoped in subdir!")
  8. endif()
  9. if(TARGET bld_testLib2)
  10. message(FATAL_ERROR "Imported target bld_testLib2 is not scoped in subdir!")
  11. endif()
  12. # Test transitive linking to a target imported in the subdirectory.
  13. add_executable(imp_testTransExe1 imp_testTransExe1.c)
  14. target_link_libraries(imp_testTransExe1 imp_lib1)
  15. add_executable(imp_testTransExe1b imp_testTransExe1.c)
  16. target_link_libraries(imp_testTransExe1b imp_lib1b)
  17. add_subdirectory(try_compile)