CMakeLists.txt 2.2 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_NAME MATCHES "IRIX|QNX")
  5. set(CMAKE_SKIP_BUILD_RPATH 1)
  6. endif()
  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()
  27. subdirs("Executable Sources" EXCLUDE_FROM_ALL "Some Examples")
  28. endif()
  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()
  36. set(PLUS_NAME_FILES
  37. "Another Subdir/pair+int.int.c"
  38. vcl_algorithm+vcl_pair+double.foo.c)
  39. endif()
  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()
  50. set(SOURCES2 ${f} ${SOURCES2})
  51. endif()
  52. endforeach()
  53. set(SOURCES ${SOURCES2})
  54. set(SOURCES ${SOURCES}
  55. vcl_algorithm_vcl_pair_double.foo.c)
  56. else()
  57. foreach(f ${SOURCES})
  58. if("${f}" STREQUAL "ThirdSubDir/pair_int.int1.c")
  59. else()
  60. set(SOURCES2 ${f} ${SOURCES2})
  61. endif()
  62. endforeach()
  63. set(SOURCES ${SOURCES2})
  64. set(SOURCES ${SOURCES}
  65. vcl_algorithm+vcl_pair+double.foo.c)
  66. endif()
  67. add_executable(TestWithAuxSourceDir ${SOURCES})
  68. if(CMAKE_PAREN)
  69. target_link_libraries(TestWithAuxSourceDir testOddPath)
  70. endif()