2008-03-25 18:27:18 +03:00
|
|
|
cmake_minimum_required (VERSION 2.6)
|
2012-08-13 21:47:32 +04:00
|
|
|
project(SUBDIR)
|
2007-02-26 18:46:19 +03:00
|
|
|
|
|
|
|
# Some systems do not seem to support rpath with spaces.
|
2014-04-11 20:27:01 +04:00
|
|
|
if(CMAKE_SYSTEM_NAME MATCHES "IRIX|QNX")
|
2012-08-13 21:47:32 +04:00
|
|
|
set(CMAKE_SKIP_BUILD_RPATH 1)
|
2012-08-13 21:50:14 +04:00
|
|
|
endif()
|
2007-02-26 18:46:19 +03:00
|
|
|
|
2007-02-23 01:15:13 +03:00
|
|
|
# be able to see output from make on dashboards
|
2012-08-13 21:47:32 +04:00
|
|
|
set(CMAKE_VERBOSE_MAKEFILE 1)
|
2007-02-27 23:11:47 +03:00
|
|
|
message("${CMAKE_MAKE_PROGRAM}")
|
|
|
|
set(CMAKE_PAREN TRUE)
|
2012-08-13 21:47:32 +04:00
|
|
|
if("${CMAKE_MAKE_PROGRAM}" MATCHES "wmake")
|
2007-02-27 23:11:47 +03:00
|
|
|
message("wmake does not support () in path")
|
|
|
|
set(CMAKE_PAREN FALSE)
|
2011-01-11 18:01:30 +03:00
|
|
|
elseif("${CMAKE_MAKE_PROGRAM}" MATCHES "make")
|
|
|
|
execute_process(COMMAND ${CMAKE_MAKE_PROGRAM} no_such_target --version
|
|
|
|
RESULT_VARIABLE res OUTPUT_VARIABLE out ERROR_VARIABLE out)
|
|
|
|
if("${out}" MATCHES "GNU Make 3.82")
|
|
|
|
# GNU Make 3.82 fails on parens: http://savannah.gnu.org/bugs/?30612
|
|
|
|
message(STATUS "GNU Make 3.82 sometimes fails on () in path")
|
|
|
|
set(CMAKE_PAREN FALSE)
|
|
|
|
endif()
|
|
|
|
endif()
|
2007-02-27 23:11:47 +03:00
|
|
|
|
2012-08-13 21:47:32 +04:00
|
|
|
if(CMAKE_PAREN)
|
|
|
|
add_definitions(-DCMAKE_PAREN=1)
|
|
|
|
subdirs("Executable Sources" "Some(x86) Sources" EXCLUDE_FROM_ALL "Some Examples")
|
2012-08-13 21:50:14 +04:00
|
|
|
else()
|
2012-08-13 21:47:32 +04:00
|
|
|
subdirs("Executable Sources" EXCLUDE_FROM_ALL "Some Examples")
|
2012-08-13 21:50:14 +04:00
|
|
|
endif()
|
2007-02-27 23:11:47 +03:00
|
|
|
|
2012-08-13 21:47:32 +04:00
|
|
|
write_file(${SUBDIR_BINARY_DIR}/ShouldBeHere "This file should exist.")
|
2007-02-19 20:23:37 +03:00
|
|
|
#WATCOM WMAKE does not support + in the name of a file!
|
2012-08-13 21:47:32 +04:00
|
|
|
if(WATCOM)
|
|
|
|
set(PLUS_NAME_FILES
|
2007-02-19 20:23:37 +03:00
|
|
|
"Another Subdir/pair_int.int.c"
|
|
|
|
vcl_algorithm_vcl_pair_double.foo.c)
|
2012-08-13 21:50:14 +04:00
|
|
|
else()
|
2012-08-13 21:47:32 +04:00
|
|
|
set(PLUS_NAME_FILES
|
2007-02-19 20:23:37 +03:00
|
|
|
"Another Subdir/pair+int.int.c"
|
|
|
|
vcl_algorithm+vcl_pair+double.foo.c)
|
2012-08-13 21:50:14 +04:00
|
|
|
endif()
|
2007-02-19 20:23:37 +03:00
|
|
|
|
2012-08-13 21:47:32 +04:00
|
|
|
add_executable(TestFromSubdir
|
2007-02-19 20:23:37 +03:00
|
|
|
"Another Subdir/testfromsubdir.c"
|
|
|
|
"Another Subdir/secondone"
|
|
|
|
${PLUS_NAME_FILES}
|
|
|
|
)
|
|
|
|
|
2012-08-13 21:47:32 +04:00
|
|
|
aux_source_directory(ThirdSubDir SOURCES)
|
|
|
|
if(WATCOM)
|
|
|
|
foreach(f ${SOURCES})
|
|
|
|
if("${f}" STREQUAL "ThirdSubDir/pair+int.int1.c")
|
2012-08-13 21:50:14 +04:00
|
|
|
else()
|
2012-08-13 21:47:32 +04:00
|
|
|
set(SOURCES2 ${f} ${SOURCES2})
|
2012-08-13 21:50:14 +04:00
|
|
|
endif()
|
|
|
|
endforeach()
|
2012-08-13 21:47:32 +04:00
|
|
|
set(SOURCES ${SOURCES2})
|
|
|
|
set(SOURCES ${SOURCES}
|
2007-02-19 20:23:37 +03:00
|
|
|
vcl_algorithm_vcl_pair_double.foo.c)
|
2012-08-13 21:50:14 +04:00
|
|
|
else()
|
2012-08-13 21:47:32 +04:00
|
|
|
foreach(f ${SOURCES})
|
|
|
|
if("${f}" STREQUAL "ThirdSubDir/pair_int.int1.c")
|
2012-08-13 21:50:14 +04:00
|
|
|
else()
|
2012-08-13 21:47:32 +04:00
|
|
|
set(SOURCES2 ${f} ${SOURCES2})
|
2012-08-13 21:50:14 +04:00
|
|
|
endif()
|
|
|
|
endforeach()
|
2012-08-13 21:47:32 +04:00
|
|
|
set(SOURCES ${SOURCES2})
|
|
|
|
set(SOURCES ${SOURCES}
|
2007-02-19 20:23:37 +03:00
|
|
|
vcl_algorithm+vcl_pair+double.foo.c)
|
2012-08-13 21:50:14 +04:00
|
|
|
endif()
|
2012-08-13 21:47:32 +04:00
|
|
|
add_executable(TestWithAuxSourceDir ${SOURCES})
|
|
|
|
if(CMAKE_PAREN)
|
2007-02-27 23:11:47 +03:00
|
|
|
target_link_libraries(TestWithAuxSourceDir testOddPath)
|
2012-08-13 21:50:14 +04:00
|
|
|
endif()
|
2007-02-22 05:24:17 +03:00
|
|
|
|