diff options
Diffstat (limited to 'Tests/RunCMake/ToolchainFile')
20 files changed, 161 insertions, 0 deletions
diff --git a/Tests/RunCMake/ToolchainFile/CMakeLists.txt b/Tests/RunCMake/ToolchainFile/CMakeLists.txt new file mode 100644 index 0000000..93ee9df --- /dev/null +++ b/Tests/RunCMake/ToolchainFile/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.5) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/ToolchainFile/CallEnableLanguage-result.txt b/Tests/RunCMake/ToolchainFile/CallEnableLanguage-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/ToolchainFile/CallEnableLanguage-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/ToolchainFile/CallEnableLanguage-stderr.txt b/Tests/RunCMake/ToolchainFile/CallEnableLanguage-stderr.txt new file mode 100644 index 0000000..0de51c6 --- /dev/null +++ b/Tests/RunCMake/ToolchainFile/CallEnableLanguage-stderr.txt @@ -0,0 +1,5 @@ +^CMake Error at CallEnableLanguage-toolchain.cmake:[0-9]+ \(enable_language\): + Language 'NONE' is currently being enabled. Recursive call not allowed. +Call Stack \(most recent call first\): + .*/Modules/CMakeDetermineSystem.cmake:[0-9]+ \(include\) + CMakeLists.txt:[0-9]+ \(project\)$ diff --git a/Tests/RunCMake/ToolchainFile/CallEnableLanguage-toolchain.cmake b/Tests/RunCMake/ToolchainFile/CallEnableLanguage-toolchain.cmake new file mode 100644 index 0000000..8145101 --- /dev/null +++ b/Tests/RunCMake/ToolchainFile/CallEnableLanguage-toolchain.cmake @@ -0,0 +1 @@ +enable_language(NONE) diff --git a/Tests/RunCMake/ToolchainFile/CallEnableLanguage.cmake b/Tests/RunCMake/ToolchainFile/CallEnableLanguage.cmake new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/ToolchainFile/CallEnableLanguage.cmake diff --git a/Tests/RunCMake/ToolchainFile/CallProject-result.txt b/Tests/RunCMake/ToolchainFile/CallProject-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/ToolchainFile/CallProject-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/ToolchainFile/CallProject-stderr.txt b/Tests/RunCMake/ToolchainFile/CallProject-stderr.txt new file mode 100644 index 0000000..e2b9f1b --- /dev/null +++ b/Tests/RunCMake/ToolchainFile/CallProject-stderr.txt @@ -0,0 +1,5 @@ +^CMake Error at CallProject-toolchain.cmake:[0-9]+ \(project\): + Language 'NONE' is currently being enabled. Recursive call not allowed. +Call Stack \(most recent call first\): + .*/Modules/CMakeDetermineSystem.cmake:[0-9]+ \(include\) + CMakeLists.txt:[0-9]+ \(project\)$ diff --git a/Tests/RunCMake/ToolchainFile/CallProject-toolchain.cmake b/Tests/RunCMake/ToolchainFile/CallProject-toolchain.cmake new file mode 100644 index 0000000..b113c13 --- /dev/null +++ b/Tests/RunCMake/ToolchainFile/CallProject-toolchain.cmake @@ -0,0 +1 @@ +project(Bad NONE) diff --git a/Tests/RunCMake/ToolchainFile/CallProject.cmake b/Tests/RunCMake/ToolchainFile/CallProject.cmake new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/ToolchainFile/CallProject.cmake diff --git a/Tests/RunCMake/ToolchainFile/FlagsInit-stdout.txt b/Tests/RunCMake/ToolchainFile/FlagsInit-stdout.txt new file mode 100644 index 0000000..e18aa8c --- /dev/null +++ b/Tests/RunCMake/ToolchainFile/FlagsInit-stdout.txt @@ -0,0 +1,30 @@ +-- CMAKE_C_FLAGS='[^ +]*-DMY_FLAGS_INIT[^ +]*' +-- CMAKE_C_FLAGS_DEBUG='[^ +]*-DMY_FLAGS_DEBUG_INIT[^ +]*' +-- CMAKE_C_FLAGS_RELEASE='[^ +]*-DMY_FLAGS_RELEASE_INIT[^ +]*' +-- CMAKE_C_FLAGS_MINSIZEREL='[^ +]*-DMY_FLAGS_MINSIZEREL_INIT[^ +]*' +-- CMAKE_C_FLAGS_RELWITHDEBINFO='[^ +]*-DMY_FLAGS_RELWITHDEBINFO_INIT[^ +]*' +-- CMAKE_CXX_FLAGS='[^ +]*-DMY_FLAGS_INIT[^ +]*' +-- CMAKE_CXX_FLAGS_DEBUG='[^ +]*-DMY_FLAGS_DEBUG_INIT[^ +]*' +-- CMAKE_CXX_FLAGS_RELEASE='[^ +]*-DMY_FLAGS_RELEASE_INIT[^ +]*' +-- CMAKE_CXX_FLAGS_MINSIZEREL='[^ +]*-DMY_FLAGS_MINSIZEREL_INIT[^ +]*' +-- CMAKE_CXX_FLAGS_RELWITHDEBINFO='[^ +]*-DMY_FLAGS_RELWITHDEBINFO_INIT[^ +]*' diff --git a/Tests/RunCMake/ToolchainFile/FlagsInit-toolchain.cmake b/Tests/RunCMake/ToolchainFile/FlagsInit-toolchain.cmake new file mode 100644 index 0000000..4c794b6 --- /dev/null +++ b/Tests/RunCMake/ToolchainFile/FlagsInit-toolchain.cmake @@ -0,0 +1,7 @@ +foreach(lang C CXX) + set(CMAKE_${lang}_FLAGS_INIT -DMY_FLAGS_INIT) + set(CMAKE_${lang}_FLAGS_DEBUG_INIT -DMY_FLAGS_DEBUG_INIT) + set(CMAKE_${lang}_FLAGS_RELEASE_INIT -DMY_FLAGS_RELEASE_INIT) + set(CMAKE_${lang}_FLAGS_MINSIZEREL_INIT -DMY_FLAGS_MINSIZEREL_INIT) + set(CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT -DMY_FLAGS_RELWITHDEBINFO_INIT) +endforeach() diff --git a/Tests/RunCMake/ToolchainFile/FlagsInit.cmake b/Tests/RunCMake/ToolchainFile/FlagsInit.cmake new file mode 100644 index 0000000..98873bf --- /dev/null +++ b/Tests/RunCMake/ToolchainFile/FlagsInit.cmake @@ -0,0 +1,7 @@ +enable_language(C) +enable_language(CXX) +foreach(lang C CXX) + foreach(c "" _DEBUG _RELEASE _MINSIZEREL _RELWITHDEBINFO) + message(STATUS "CMAKE_${lang}_FLAGS${c}='${CMAKE_${lang}_FLAGS${c}}'") + endforeach() +endforeach() diff --git a/Tests/RunCMake/ToolchainFile/IncludeDirectories-toolchain.cmake b/Tests/RunCMake/ToolchainFile/IncludeDirectories-toolchain.cmake new file mode 100644 index 0000000..e77e9fe --- /dev/null +++ b/Tests/RunCMake/ToolchainFile/IncludeDirectories-toolchain.cmake @@ -0,0 +1 @@ +include_directories(${CMAKE_CURRENT_LIST_DIR}/IncludeDirectories) diff --git a/Tests/RunCMake/ToolchainFile/IncludeDirectories.c b/Tests/RunCMake/ToolchainFile/IncludeDirectories.c new file mode 100644 index 0000000..81b2465 --- /dev/null +++ b/Tests/RunCMake/ToolchainFile/IncludeDirectories.c @@ -0,0 +1,5 @@ +#include <IncDir.h> + +void IncDir(void) +{ +} diff --git a/Tests/RunCMake/ToolchainFile/IncludeDirectories.cmake b/Tests/RunCMake/ToolchainFile/IncludeDirectories.cmake new file mode 100644 index 0000000..616cff4 --- /dev/null +++ b/Tests/RunCMake/ToolchainFile/IncludeDirectories.cmake @@ -0,0 +1,2 @@ +enable_language(C) +add_library(IncDir STATIC IncludeDirectories.c) diff --git a/Tests/RunCMake/ToolchainFile/IncludeDirectories/IncDir.h b/Tests/RunCMake/ToolchainFile/IncludeDirectories/IncDir.h new file mode 100644 index 0000000..bca9c2c --- /dev/null +++ b/Tests/RunCMake/ToolchainFile/IncludeDirectories/IncDir.h @@ -0,0 +1 @@ +/* IncDir.h */ diff --git a/Tests/RunCMake/ToolchainFile/LinkFlagsInit-stdout.txt b/Tests/RunCMake/ToolchainFile/LinkFlagsInit-stdout.txt new file mode 100644 index 0000000..0ddf7d2 --- /dev/null +++ b/Tests/RunCMake/ToolchainFile/LinkFlagsInit-stdout.txt @@ -0,0 +1,60 @@ +-- CMAKE_EXE_LINKER_FLAGS='[^ +]*MY_EXE_FLAGS_INIT[^ +]*' +-- CMAKE_EXE_LINKER_FLAGS_DEBUG='[^ +]*MY_EXE_FLAGS_DEBUG_INIT[^ +]*' +-- CMAKE_EXE_LINKER_FLAGS_RELEASE='[^ +]*MY_EXE_FLAGS_RELEASE_INIT[^ +]*' +-- CMAKE_EXE_LINKER_FLAGS_MINSIZEREL='[^ +]*MY_EXE_FLAGS_MINSIZEREL_INIT[^ +]*' +-- CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO='[^ +]*MY_EXE_FLAGS_RELWITHDEBINFO_INIT[^ +]*' +-- CMAKE_SHARED_LINKER_FLAGS='[^ +]*MY_SHARED_FLAGS_INIT[^ +]*' +-- CMAKE_SHARED_LINKER_FLAGS_DEBUG='[^ +]*MY_SHARED_FLAGS_DEBUG_INIT[^ +]*' +-- CMAKE_SHARED_LINKER_FLAGS_RELEASE='[^ +]*MY_SHARED_FLAGS_RELEASE_INIT[^ +]*' +-- CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL='[^ +]*MY_SHARED_FLAGS_MINSIZEREL_INIT[^ +]*' +-- CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO='[^ +]*MY_SHARED_FLAGS_RELWITHDEBINFO_INIT[^ +]*' +-- CMAKE_MODULE_LINKER_FLAGS='[^ +]*MY_MODULE_FLAGS_INIT[^ +]*' +-- CMAKE_MODULE_LINKER_FLAGS_DEBUG='[^ +]*MY_MODULE_FLAGS_DEBUG_INIT[^ +]*' +-- CMAKE_MODULE_LINKER_FLAGS_RELEASE='[^ +]*MY_MODULE_FLAGS_RELEASE_INIT[^ +]*' +-- CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL='[^ +]*MY_MODULE_FLAGS_MINSIZEREL_INIT[^ +]*' +-- CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO='[^ +]*MY_MODULE_FLAGS_RELWITHDEBINFO_INIT[^ +]*' +-- CMAKE_STATIC_LINKER_FLAGS='[^ +]*MY_STATIC_FLAGS_INIT[^ +]*' +-- CMAKE_STATIC_LINKER_FLAGS_DEBUG='[^ +]*MY_STATIC_FLAGS_DEBUG_INIT[^ +]*' +-- CMAKE_STATIC_LINKER_FLAGS_RELEASE='[^ +]*MY_STATIC_FLAGS_RELEASE_INIT[^ +]*' +-- CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL='[^ +]*MY_STATIC_FLAGS_MINSIZEREL_INIT[^ +]*' +-- CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO='[^ +]*MY_STATIC_FLAGS_RELWITHDEBINFO_INIT[^ +]*' diff --git a/Tests/RunCMake/ToolchainFile/LinkFlagsInit-toolchain.cmake b/Tests/RunCMake/ToolchainFile/LinkFlagsInit-toolchain.cmake new file mode 100644 index 0000000..ca908ae --- /dev/null +++ b/Tests/RunCMake/ToolchainFile/LinkFlagsInit-toolchain.cmake @@ -0,0 +1,5 @@ +foreach(t EXE SHARED MODULE STATIC) + foreach(c "" _DEBUG _RELEASE _MINSIZEREL _RELWITHDEBINFO) + set(CMAKE_${t}_LINKER_FLAGS${c}_INIT MY_${t}_FLAGS${c}_INIT) + endforeach() +endforeach() diff --git a/Tests/RunCMake/ToolchainFile/LinkFlagsInit.cmake b/Tests/RunCMake/ToolchainFile/LinkFlagsInit.cmake new file mode 100644 index 0000000..069d741 --- /dev/null +++ b/Tests/RunCMake/ToolchainFile/LinkFlagsInit.cmake @@ -0,0 +1,7 @@ +set(CMAKE_C_COMPILER_FORCED 1) # skip compiler test so we can check cached values +enable_language(C) +foreach(t EXE SHARED MODULE STATIC) + foreach(c "" _DEBUG _RELEASE _MINSIZEREL _RELWITHDEBINFO) + message(STATUS "CMAKE_${t}_LINKER_FLAGS${c}='${CMAKE_${t}_LINKER_FLAGS${c}}'") + endforeach() +endforeach() diff --git a/Tests/RunCMake/ToolchainFile/RunCMakeTest.cmake b/Tests/RunCMake/ToolchainFile/RunCMakeTest.cmake new file mode 100644 index 0000000..7eb4485 --- /dev/null +++ b/Tests/RunCMake/ToolchainFile/RunCMakeTest.cmake @@ -0,0 +1,19 @@ +include(RunCMake) + +function(run_cmake_toolchain t) + set(RunCMake_TEST_OPTIONS -DCMAKE_TOOLCHAIN_FILE=${RunCMake_SOURCE_DIR}/${t}-toolchain.cmake) + run_cmake(${t}) +endfunction() + +run_cmake_toolchain(CallEnableLanguage) +run_cmake_toolchain(CallProject) +run_cmake_toolchain(FlagsInit) +run_cmake_toolchain(LinkFlagsInit) + +function(run_IncludeDirectories) + run_cmake_toolchain(IncludeDirectories) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/IncludeDirectories-build) + set(RunCMake_TEST_NO_CLEAN 1) + run_cmake_command(IncludeDirectories-build ${CMAKE_COMMAND} --build . --config Debug) +endfunction() +run_IncludeDirectories() |