summaryrefslogtreecommitdiffstats
path: root/Tests/VSExcludeFromDefaultBuild
diff options
context:
space:
mode:
Diffstat (limited to 'Tests/VSExcludeFromDefaultBuild')
-rw-r--r--Tests/VSExcludeFromDefaultBuild/CMakeLists.txt4
-rw-r--r--Tests/VSExcludeFromDefaultBuild/ClearExes.cmake4
-rw-r--r--Tests/VSExcludeFromDefaultBuild/ResultTest.cmake6
3 files changed, 14 insertions, 0 deletions
diff --git a/Tests/VSExcludeFromDefaultBuild/CMakeLists.txt b/Tests/VSExcludeFromDefaultBuild/CMakeLists.txt
index d30414b..243fdf5 100644
--- a/Tests/VSExcludeFromDefaultBuild/CMakeLists.txt
+++ b/Tests/VSExcludeFromDefaultBuild/CMakeLists.txt
@@ -1,6 +1,9 @@
cmake_minimum_required(VERSION 2.8.9)
project(VSExcludeFromDefaultBuild)
+# CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD will enable the INSTALL target to be part of the default build
+set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD 1)
+
# First step is to clear all .exe files in output so that possible past
# failures of this test do not prevent it from succeeding.
add_custom_target(ClearExes ALL
@@ -13,6 +16,7 @@ add_custom_target(ClearExes ALL
function(add_test_executable target)
add_executable("${target}" ${ARGN})
add_dependencies("${target}" ClearExes)
+ install(TARGETS "${target}" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>/install" OPTIONAL)
endfunction()
add_test_executable(DefaultBuilt main.c)
diff --git a/Tests/VSExcludeFromDefaultBuild/ClearExes.cmake b/Tests/VSExcludeFromDefaultBuild/ClearExes.cmake
index ece30ad..99cf1a5 100644
--- a/Tests/VSExcludeFromDefaultBuild/ClearExes.cmake
+++ b/Tests/VSExcludeFromDefaultBuild/ClearExes.cmake
@@ -2,3 +2,7 @@ file(GLOB exeFiles "${dir}/*.exe")
foreach(exeFile IN LISTS exeFiles)
file(REMOVE "${exeFile}")
endforeach()
+file(GLOB exeFiles "${dir}/install/*.exe")
+foreach(exeFile IN LISTS exeFiles)
+ file(REMOVE "${exeFile}")
+endforeach()
diff --git a/Tests/VSExcludeFromDefaultBuild/ResultTest.cmake b/Tests/VSExcludeFromDefaultBuild/ResultTest.cmake
index 8fb00bf..f96e70b 100644
--- a/Tests/VSExcludeFromDefaultBuild/ResultTest.cmake
+++ b/Tests/VSExcludeFromDefaultBuild/ResultTest.cmake
@@ -7,6 +7,12 @@ macro(TestExists exeName)
else()
message(FATAL_ERROR "File ${exeFile} was expected ${ARGN} to exist!")
endif()
+ set(exeFile "${dir}/${activeConfig}/install/${exeName}.exe")
+ if(${ARGN} EXISTS "${exeFile}")
+ message(STATUS "File ${exeFile} was correctly found ${ARGN} to exist.")
+ else()
+ message(FATAL_ERROR "File ${exeFile} was expected ${ARGN} to exist!")
+ endif()
endmacro()
TestExists(DefaultBuilt)