blob: 2e2c2655ccfb640f8fe00256669922eaa4e36d54 [file]
include(RunCMake)
function(run_and_build test)
if(RunCMake_GENERATOR_IS_MULTI_CONFIG)
set(config_options "-DCMAKE_CONFIGURATION_TYPES=Debug")
else()
set(config_options -DCMAKE_BUILD_TYPE=Debug)
endif()
set(RunCMake_TEST_OPTIONS ${config_options})
set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/${test}-build")
run_cmake_with_options(${test})
set(RunCMake_TEST_NO_CLEAN 1)
if(ARGN)
foreach(target IN LISTS ARGN)
run_cmake_command(${test}-${target} ${CMAKE_COMMAND} --build . --config Debug --target ${target} --verbose)
endforeach()
else()
run_cmake_command(${test}-build ${CMAKE_COMMAND} --build . --config Debug --verbose)
endif()
endfunction()
function(run_and_check test)
set(RunCMake_TEST_OUTPUT_MERGE TRUE)
run_and_build(${test} ${ARGN})
endfunction()
run_cmake(FileNoExist)
run_cmake(TargetProperties)
run_and_build(FileSetProperties)
run_and_build(CustomCommandInput)
run_and_build(IncludeDirectoriesOrder)
run_and_build(FileSetTransitivity)
run_and_check(CompileOptionsOrder)
if(APPLE)
run_cmake(FileSetFramework1)
run_and_build(FileSetFramework2)
endif()
if (RunCMake_GENERATOR MATCHES "Ninja")
run_cmake(IndependentFilesWarning)
if (RunCMake_GENERATOR_IS_MULTI_CONFIG)
set(IndependentFiles_target "CMakeFiles/lib1.dir/Debug/independent.c${CMAKE_C_OUTPUT_EXTENSION}")
else ()
set(IndependentFiles_target "CMakeFiles/lib1.dir/independent.c${CMAKE_C_OUTPUT_EXTENSION}")
endif ()
set(RunCMake-check-file IndependentFiles-check.cmake)
run_and_build(IndependentFiles ${IndependentFiles_target})
endif()
# Some environments are excluded because they are not able to honor verbose mode
if ((RunCMake_GENERATOR MATCHES "Makefiles|Ninja|Xcode"
OR (RunCMake_GENERATOR MATCHES "Visual Studio" AND MSVC_VERSION GREATER_EQUAL "1600"))
AND NOT CMAKE_C_COMPILER_ID STREQUAL "Intel")
run_and_check(FileSetProperties2 lib1 main)
endif()
function(run_export_import name)
if(ARGV1)
set(importname ${ARGV1})
else()
set(importname ${name})
endif()
if(RunCMake_GENERATOR_IS_MULTI_CONFIG)
set(_config_options "-DCMAKE_CONFIGURATION_TYPES=Debug\\\\;Release")
else()
set(_config_options -DCMAKE_BUILD_TYPE=Debug)
endif()
set(RunCMake_TEST_NO_CLEAN 1)
set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/${name}Export-build")
set(RunCMake_TEST_OPTIONS "--install-prefix=${RunCMake_TEST_BINARY_DIR}/install" ${_config_options})
file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
run_cmake(${name}Export)
if(RunCMake_GENERATOR_IS_MULTI_CONFIG)
run_cmake_command(${name}Export-build-Debug ${CMAKE_COMMAND} --build . --config Debug)
run_cmake_command(${name}Export-install-Debug ${CMAKE_COMMAND} --install . --config Debug)
run_cmake_command(${name}Export-build-Release ${CMAKE_COMMAND} --build . --config Release)
run_cmake_command(${name}Export-install-Release ${CMAKE_COMMAND} --install . --config Release)
else()
run_cmake_command(${name}Export-build ${CMAKE_COMMAND} --build . --config Debug)
run_cmake_command(${name}Export-install ${CMAKE_COMMAND} --install . --config Debug)
endif()
unset(RunCMake_TEST_OPTIONS)
set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/${importname}Import-build")
unset(RunCMake_TEST_OPTIONS)
file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
run_cmake(${importname}Import)
if(RunCMake_GENERATOR_IS_MULTI_CONFIG)
run_cmake_command(${importname}Import-build-Debug ${CMAKE_COMMAND} --build . --config Debug)
run_cmake_command(${importname}Import-build-Release ${CMAKE_COMMAND} --build . --config Release)
else()
run_cmake_command(${importname}Import-build ${CMAKE_COMMAND} --build . --config Debug)
endif()
unset(RunCMake_TEST_BINARY_DIR)
unset(RunCMake_TEST_NO_CLEAN)
endfunction()
run_cmake(InstallMissingSetsInterface)
run_cmake(InstallMissingSetsInterfacePostInstall)
run_export_import(FileSet)