Files
CMake/Tests/SubDirSpaces/CMakeLists.txt
T
Brad King f53bd6f450 Tests: Bump CMake minimum required in tests to 3.5
CMake 3.27 deprecates compatibility with CMake < 3.5.  Update tests that
do not cover older interfaces to avoid the deprecation warning.

Follow the pattern from:

* commit 7b07ccdd2b (Tests/*Only: Update cmake_minimum_required versions,
                     2020-06-15, v3.19.0-rc1~629^2~1)

* commit 72e7c45e98 (Tests: Bump CMake minimum required in tests to 2.8.12,
                     2020-12-22, v3.20.0-rc1~224^2)

* commit f6b4db365a (Tests: bump cmake_minimum_required version to 2.8.12,
                     2021-04-04, v3.21.0-rc1~372^2)

Also remove explicit `cmake_policy` settings made redundant by the
version.
2023-03-01 16:36:54 -05:00

78 lines
2.2 KiB
CMake

cmake_minimum_required (VERSION 3.5)
project(SUBDIR)
# Some systems do not seem to support rpath with spaces.
if(CMAKE_SYSTEM_NAME MATCHES "QNX")
set(CMAKE_SKIP_BUILD_RPATH 1)
endif()
# be able to see output from make on dashboards
set(CMAKE_VERBOSE_MAKEFILE 1)
message("${CMAKE_MAKE_PROGRAM}")
set(CMAKE_PAREN TRUE)
if("${CMAKE_MAKE_PROGRAM}" MATCHES "wmake")
message("wmake does not support () in path")
set(CMAKE_PAREN FALSE)
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()
if(CMAKE_PAREN)
add_definitions(-DCMAKE_PAREN=1)
subdirs("Executable Sources" "Some(x86) Sources" EXCLUDE_FROM_ALL "Some Examples")
else()
subdirs("Executable Sources" EXCLUDE_FROM_ALL "Some Examples")
endif()
write_file(${SUBDIR_BINARY_DIR}/ShouldBeHere "This file should exist.")
#WATCOM WMAKE does not support + in the name of a file!
if(WATCOM)
set(PLUS_NAME_FILES
"Another Subdir/pair_int.int.c"
vcl_algorithm_vcl_pair_double.foo.c)
else()
set(PLUS_NAME_FILES
"Another Subdir/pair+int.int.c"
vcl_algorithm+vcl_pair+double.foo.c)
endif()
add_executable(TestFromSubdir
"Another Subdir/testfromsubdir.c"
"Another Subdir/secondone"
${PLUS_NAME_FILES}
)
aux_source_directory(ThirdSubDir SOURCES)
if(WATCOM)
foreach(f ${SOURCES})
if("${f}" STREQUAL "ThirdSubDir/pair+int.int1.c")
else()
set(SOURCES2 ${f} ${SOURCES2})
endif()
endforeach()
set(SOURCES ${SOURCES2})
set(SOURCES ${SOURCES}
vcl_algorithm_vcl_pair_double.foo.c)
else()
foreach(f ${SOURCES})
if("${f}" STREQUAL "ThirdSubDir/pair_int.int1.c")
else()
set(SOURCES2 ${f} ${SOURCES2})
endif()
endforeach()
set(SOURCES ${SOURCES2})
set(SOURCES ${SOURCES}
vcl_algorithm+vcl_pair+double.foo.c)
endif()
add_executable(TestWithAuxSourceDir ${SOURCES})
if(CMAKE_PAREN)
target_link_libraries(TestWithAuxSourceDir testOddPath)
endif()