Merge topic 'vs-framework-references'
[kiteware-cmake.git] / Tests / SubDirSpaces / CMakeLists.txt
blob26a7da98d316d9e485c692c51860d4039cb78844
1 cmake_minimum_required (VERSION 3.5)
2 project(SUBDIR)
4 # Some systems do not seem to support rpath with spaces.
5 if(CMAKE_SYSTEM_NAME MATCHES "QNX")
6   set(CMAKE_SKIP_BUILD_RPATH 1)
7 endif()
9 # be able to see output from make on dashboards
10 set(CMAKE_VERBOSE_MAKEFILE 1)
11 message("${CMAKE_MAKE_PROGRAM}")
12 set(CMAKE_PAREN TRUE)
13 if("${CMAKE_MAKE_PROGRAM}" MATCHES "wmake")
14   message("wmake does not support () in path")
15   set(CMAKE_PAREN FALSE)
16 elseif("${CMAKE_MAKE_PROGRAM}" MATCHES "make")
17   execute_process(COMMAND ${CMAKE_MAKE_PROGRAM} no_such_target --version
18     RESULT_VARIABLE res OUTPUT_VARIABLE out ERROR_VARIABLE out)
19   if("${out}" MATCHES "GNU Make 3.82")
20     # GNU Make 3.82 fails on parens: http://savannah.gnu.org/bugs/?30612
21     message(STATUS "GNU Make 3.82 sometimes fails on () in path")
22     set(CMAKE_PAREN FALSE)
23   endif()
24 endif()
26 if(CMAKE_PAREN)
27   add_definitions(-DCMAKE_PAREN=1)
28   subdirs("Executable Sources" "Some(x86) Sources" EXCLUDE_FROM_ALL "Some Examples")
29 else()
30   subdirs("Executable Sources" EXCLUDE_FROM_ALL "Some Examples")
31 endif()
33 write_file(${SUBDIR_BINARY_DIR}/ShouldBeHere "This file should exist.")
34 #WATCOM WMAKE does not support + in the name of a file!
35 if(WATCOM)
36   set(PLUS_NAME_FILES
37     "Another Subdir/pair_int.int.c"
38     vcl_algorithm_vcl_pair_double.foo.c)
39 else()
40     set(PLUS_NAME_FILES
41     "Another Subdir/pair+int.int.c"
42     vcl_algorithm+vcl_pair+double.foo.c)
43 endif()
45 add_executable(TestFromSubdir
46   "Another Subdir/testfromsubdir.c"
47   "Another Subdir/secondone"
48   ${PLUS_NAME_FILES}
49   )
51 aux_source_directory(ThirdSubDir SOURCES)
52 if(WATCOM)
53   foreach(f ${SOURCES})
54     if("${f}" STREQUAL "ThirdSubDir/pair+int.int1.c")
55     else()
56       set(SOURCES2 ${f} ${SOURCES2})
57     endif()
58   endforeach()
59   set(SOURCES ${SOURCES2})
60   set(SOURCES ${SOURCES}
61     vcl_algorithm_vcl_pair_double.foo.c)
62 else()
63   foreach(f ${SOURCES})
64     if("${f}" STREQUAL "ThirdSubDir/pair_int.int1.c")
65     else()
66       set(SOURCES2 ${f} ${SOURCES2})
67     endif()
68   endforeach()
69   set(SOURCES ${SOURCES2})
70   set(SOURCES ${SOURCES}
71     vcl_algorithm+vcl_pair+double.foo.c)
72 endif()
73 add_executable(TestWithAuxSourceDir ${SOURCES})
74 if(CMAKE_PAREN)
75   target_link_libraries(TestWithAuxSourceDir testOddPath)
76 endif()