CMakeLists.txt 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. cmake_minimum_required (VERSION 2.6)
  2. PROJECT(SUBDIR)
  3. # Some systems do not seem to support rpath with spaces.
  4. IF("${CMAKE_SYSTEM}" MATCHES "IRIX|QNX")
  5. SET(CMAKE_SKIP_BUILD_RPATH 1)
  6. ENDIF("${CMAKE_SYSTEM}" MATCHES "IRIX|QNX")
  7. # be able to see output from make on dashboards
  8. SET(CMAKE_VERBOSE_MAKEFILE 1)
  9. message("${CMAKE_MAKE_PROGRAM}")
  10. set(CMAKE_PAREN TRUE)
  11. IF("${CMAKE_MAKE_PROGRAM}" MATCHES "wmake")
  12. message("wmake does not support () in path")
  13. set(CMAKE_PAREN FALSE)
  14. elseif("${CMAKE_MAKE_PROGRAM}" MATCHES "make")
  15. execute_process(COMMAND ${CMAKE_MAKE_PROGRAM} no_such_target --version
  16. RESULT_VARIABLE res OUTPUT_VARIABLE out ERROR_VARIABLE out)
  17. if("${out}" MATCHES "GNU Make 3.82")
  18. # GNU Make 3.82 fails on parens: http://savannah.gnu.org/bugs/?30612
  19. message(STATUS "GNU Make 3.82 sometimes fails on () in path")
  20. set(CMAKE_PAREN FALSE)
  21. endif()
  22. endif()
  23. IF(CMAKE_PAREN)
  24. ADD_DEFINITIONS(-DCMAKE_PAREN=1)
  25. SUBDIRS("Executable Sources" "Some(x86) Sources" EXCLUDE_FROM_ALL "Some Examples")
  26. ELSE(CMAKE_PAREN)
  27. SUBDIRS("Executable Sources" EXCLUDE_FROM_ALL "Some Examples")
  28. ENDIF(CMAKE_PAREN)
  29. WRITE_FILE(${SUBDIR_BINARY_DIR}/ShouldBeHere "This file should exist.")
  30. #WATCOM WMAKE does not support + in the name of a file!
  31. IF(WATCOM)
  32. SET(PLUS_NAME_FILES
  33. "Another Subdir/pair_int.int.c"
  34. vcl_algorithm_vcl_pair_double.foo.c)
  35. ELSE(WATCOM)
  36. SET(PLUS_NAME_FILES
  37. "Another Subdir/pair+int.int.c"
  38. vcl_algorithm+vcl_pair+double.foo.c)
  39. ENDIF(WATCOM)
  40. ADD_EXECUTABLE(TestFromSubdir
  41. "Another Subdir/testfromsubdir.c"
  42. "Another Subdir/secondone"
  43. ${PLUS_NAME_FILES}
  44. )
  45. AUX_SOURCE_DIRECTORY(ThirdSubDir SOURCES)
  46. IF(WATCOM)
  47. FOREACH(f ${SOURCES})
  48. IF("${f}" STREQUAL "ThirdSubDir/pair+int.int1.c")
  49. ELSE("${f}" STREQUAL "ThirdSubDir/pair+int.int1.c")
  50. SET(SOURCES2 ${f} ${SOURCES2})
  51. ENDIF("${f}" STREQUAL "ThirdSubDir/pair+int.int1.c")
  52. ENDFOREACH(f)
  53. SET(SOURCES ${SOURCES2})
  54. SET(SOURCES ${SOURCES}
  55. vcl_algorithm_vcl_pair_double.foo.c)
  56. ELSE(WATCOM)
  57. FOREACH(f ${SOURCES})
  58. IF("${f}" STREQUAL "ThirdSubDir/pair_int.int1.c")
  59. ELSE("${f}" STREQUAL "ThirdSubDir/pair_int.int1.c")
  60. SET(SOURCES2 ${f} ${SOURCES2})
  61. ENDIF("${f}" STREQUAL "ThirdSubDir/pair_int.int1.c")
  62. ENDFOREACH(f)
  63. SET(SOURCES ${SOURCES2})
  64. SET(SOURCES ${SOURCES}
  65. vcl_algorithm+vcl_pair+double.foo.c)
  66. ENDIF(WATCOM)
  67. ADD_EXECUTABLE(TestWithAuxSourceDir ${SOURCES})
  68. IF(CMAKE_PAREN)
  69. target_link_libraries(TestWithAuxSourceDir testOddPath)
  70. ENDIF(CMAKE_PAREN)