CMakeLists.txt 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. cmake_minimum_required (VERSION 2.6)
  2. PROJECT(VSExternalInclude)
  3. IF(${CMAKE_GENERATOR} MATCHES "Visual Studio 6")
  4. SET(PROJECT_EXT dsp)
  5. ELSE(${CMAKE_GENERATOR} MATCHES "Visual Studio 6")
  6. SET(PROJECT_EXT vcproj)
  7. ENDIF(${CMAKE_GENERATOR} MATCHES "Visual Studio 6")
  8. # make sure directories exists
  9. SET(LIB1_BINARY_DIR ${VSExternalInclude_BINARY_DIR}/Lib1)
  10. MAKE_DIRECTORY("${LIB1_BINARY_DIR}")
  11. SET(LIB2_BINARY_DIR ${VSExternalInclude_BINARY_DIR}/Lib2)
  12. MAKE_DIRECTORY("${LIB2_BINARY_DIR}")
  13. # generate lib1
  14. EXEC_PROGRAM("${CMAKE_COMMAND}" "${LIB1_BINARY_DIR}" ARGS -G\"${CMAKE_GENERATOR}\"
  15. \"${VSExternalInclude_SOURCE_DIR}/Lib1\" OUTPUT_VARIABLE OUT)
  16. MESSAGE("CMAKE Ran with the following output:\n\"${OUT}\"")
  17. # generate lib2
  18. EXEC_PROGRAM("${CMAKE_COMMAND}" "${LIB2_BINARY_DIR}" ARGS -G\"${CMAKE_GENERATOR}\"
  19. \"${VSExternalInclude_SOURCE_DIR}/Lib2\" OUTPUT_VARIABLE OUT)
  20. MESSAGE("CMAKE Ran with the following output:\n\"${OUT}\"")
  21. INCLUDE_EXTERNAL_MSPROJECT(lib1 ${VSExternalInclude_BINARY_DIR}/Lib1/LIB1.${PROJECT_EXT})
  22. # lib2 depends on lib1
  23. INCLUDE_EXTERNAL_MSPROJECT(lib2 ${VSExternalInclude_BINARY_DIR}/Lib2/LIB2.${PROJECT_EXT} lib1)
  24. INCLUDE_DIRECTORIES(${VSExternalInclude_SOURCE_DIR}/Lib2 ${VSExternalInclude_SOURCE_DIR}/Lib1)
  25. SET(SOURCES main.cpp)
  26. ADD_EXECUTABLE(VSExternalInclude ${SOURCES})
  27. # target depends on lib2
  28. ADD_DEPENDENCIES(VSExternalInclude lib2)