summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
Diffstat (limited to 'Tests')
-rw-r--r--Tests/CMakeOnly/AllFindModules/CMakeLists.txt6
-rw-r--r--Tests/CustomCommandWorkingDirectory/CMakeLists.txt2
-rw-r--r--Tests/FindModulesExecuteAll/CMakeLists.txt2
-rw-r--r--Tests/JavaExportImport/BuildExport/CMakeLists.txt5
-rw-r--r--Tests/JavaExportImport/Import/CMakeLists.txt2
-rw-r--r--Tests/JavaExportImport/InstallExport/CMakeLists.txt1
-rw-r--r--Tests/RunCMake/CMakeLists.txt4
-rw-r--r--Tests/RunCMake/CommandLine/DeprecateVS8-WARN-OFF.cmake0
-rw-r--r--Tests/RunCMake/CommandLine/DeprecateVS8-WARN-ON-stderr.txt5
-rw-r--r--Tests/RunCMake/CommandLine/DeprecateVS8-WARN-ON.cmake0
-rw-r--r--Tests/RunCMake/CommandLine/RunCMakeTest.cmake7
-rw-r--r--Tests/RunCMake/Ninja/AssumedSources.cmake20
-rw-r--r--Tests/RunCMake/Ninja/LooseObjectDepends.cmake26
-rw-r--r--Tests/RunCMake/Ninja/RunCMakeTest.cmake35
-rw-r--r--Tests/RunCMake/Ninja/dep.c4
-rw-r--r--Tests/RunCMake/Ninja/top.c7
-rw-r--r--Tests/RunCMake/RunCMake.cmake3
17 files changed, 120 insertions, 9 deletions
diff --git a/Tests/CMakeOnly/AllFindModules/CMakeLists.txt b/Tests/CMakeOnly/AllFindModules/CMakeLists.txt
index 7eb679c..443d366 100644
--- a/Tests/CMakeOnly/AllFindModules/CMakeLists.txt
+++ b/Tests/CMakeOnly/AllFindModules/CMakeLists.txt
@@ -1,10 +1,6 @@
-cmake_minimum_required (VERSION 2.8)
+cmake_minimum_required(VERSION 2.8.4) # new enough for CMP0017
project(AllFindModules)
-if (POLICY CMP0017)
- cmake_policy(SET CMP0017 NEW)
-endif ()
-
# Avoid ctest truncation of output
message(STATUS "CTEST_FULL_OUTPUT")
diff --git a/Tests/CustomCommandWorkingDirectory/CMakeLists.txt b/Tests/CustomCommandWorkingDirectory/CMakeLists.txt
index f917cd7..4975feb 100644
--- a/Tests/CustomCommandWorkingDirectory/CMakeLists.txt
+++ b/Tests/CustomCommandWorkingDirectory/CMakeLists.txt
@@ -19,6 +19,7 @@ add_executable(working "${TestWorkingDir_BINARY_DIR}/working.c"
add_custom_target(
Custom ALL
COMMAND "${CMAKE_COMMAND}" -E copy_if_different ./customTarget.c "${TestWorkingDir_BINARY_DIR}/customTarget.c"
+ BYPRODUCTS "${TestWorkingDir_BINARY_DIR}/customTarget.c"
WORKING_DIRECTORY "${TestWorkingDir_SOURCE_DIR}"
)
@@ -36,6 +37,7 @@ add_executable(working2 working2.c ${TestWorkingDir_BINARY_DIR}/customTarget2.c)
add_custom_target(
Custom2 ALL
COMMAND "${CMAKE_COMMAND}" -E copy_if_different ${TestWorkingDir_SOURCE_DIR}/customTarget.c ../customTarget2.c
+ BYPRODUCTS "${TestWorkingDir_BINARY_DIR}/customTarget2.c"
WORKING_DIRECTORY work/ # Relative to build tree, trailing slash
)
diff --git a/Tests/FindModulesExecuteAll/CMakeLists.txt b/Tests/FindModulesExecuteAll/CMakeLists.txt
index 21b9d38..4893bb3 100644
--- a/Tests/FindModulesExecuteAll/CMakeLists.txt
+++ b/Tests/FindModulesExecuteAll/CMakeLists.txt
@@ -6,8 +6,8 @@
#
# I guess more things could be added, like checking whether variables are
# defined after running the modules (e.g. FOO_FOUND etc.).
+cmake_minimum_required(VERSION 2.8.4) # new enough for CMP0017
project(FindModulesExecuteAll)
-cmake_minimum_required(VERSION 2.7)
file(GLOB all_modules "${CMAKE_CURRENT_SOURCE_DIR}/../../Modules/Find*cmake")
diff --git a/Tests/JavaExportImport/BuildExport/CMakeLists.txt b/Tests/JavaExportImport/BuildExport/CMakeLists.txt
index 953f9d0..fa7e501 100644
--- a/Tests/JavaExportImport/BuildExport/CMakeLists.txt
+++ b/Tests/JavaExportImport/BuildExport/CMakeLists.txt
@@ -7,4 +7,7 @@ find_package(Java COMPONENTS Development)
include(UseJava)
add_jar(${PROJECT_NAME} Foo.java)
-export_jars(TARGETS ${PROJECT_NAME} FILE JavaBuildExportTestConfig.cmake)
+export_jars(
+ TARGETS ${PROJECT_NAME}
+ NAMESPACE foo::
+ FILE JavaBuildExportTestConfig.cmake)
diff --git a/Tests/JavaExportImport/Import/CMakeLists.txt b/Tests/JavaExportImport/Import/CMakeLists.txt
index 79a1447..13ec05d 100644
--- a/Tests/JavaExportImport/Import/CMakeLists.txt
+++ b/Tests/JavaExportImport/Import/CMakeLists.txt
@@ -11,4 +11,4 @@ find_package(JavaInstallExportTest REQUIRED)
add_jar(${PROJECT_NAME}
SOURCES Import.java
- INCLUDE_JARS foo bar)
+ INCLUDE_JARS foo::foo bar::bar)
diff --git a/Tests/JavaExportImport/InstallExport/CMakeLists.txt b/Tests/JavaExportImport/InstallExport/CMakeLists.txt
index 0a9afd9..2923beb 100644
--- a/Tests/JavaExportImport/InstallExport/CMakeLists.txt
+++ b/Tests/JavaExportImport/InstallExport/CMakeLists.txt
@@ -10,5 +10,6 @@ add_jar(${PROJECT_NAME} Bar.java)
install_jar(${PROJECT_NAME} DESTINATION share/java)
install_jar_exports(
TARGETS ${PROJECT_NAME}
+ NAMESPACE bar::
FILE JavaInstallExportTestConfig.cmake
DESTINATION share/cmake)
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index 32c4be8..21e6259 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -119,6 +119,10 @@ if(CMAKE_GENERATOR MATCHES "Make")
add_RunCMake_test(Make)
endif()
if(CMAKE_GENERATOR STREQUAL "Ninja")
+ set(Ninja_ARGS
+ -DCMAKE_C_OUTPUT_EXTENSION=${CMAKE_C_OUTPUT_EXTENSION}
+ -DCMAKE_SHARED_LIBRARY_PREFIX=${CMAKE_SHARED_LIBRARY_PREFIX}
+ -DCMAKE_SHARED_LIBRARY_SUFFIX=${CMAKE_SHARED_LIBRARY_SUFFIX})
add_RunCMake_test(Ninja)
endif()
add_RunCMake_test(CTest)
diff --git a/Tests/RunCMake/CommandLine/DeprecateVS8-WARN-OFF.cmake b/Tests/RunCMake/CommandLine/DeprecateVS8-WARN-OFF.cmake
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/DeprecateVS8-WARN-OFF.cmake
diff --git a/Tests/RunCMake/CommandLine/DeprecateVS8-WARN-ON-stderr.txt b/Tests/RunCMake/CommandLine/DeprecateVS8-WARN-ON-stderr.txt
new file mode 100644
index 0000000..2f2cbd3
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/DeprecateVS8-WARN-ON-stderr.txt
@@ -0,0 +1,5 @@
+^CMake Warning:
+ The "Visual Studio 8 2005" generator is deprecated and will be removed in a
+ future version of CMake.
+
+ Add CMAKE_WARN_VS8=OFF to the cache to disable this warning.$
diff --git a/Tests/RunCMake/CommandLine/DeprecateVS8-WARN-ON.cmake b/Tests/RunCMake/CommandLine/DeprecateVS8-WARN-ON.cmake
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/DeprecateVS8-WARN-ON.cmake
diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
index f327f78..f94b10a 100644
--- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
@@ -78,6 +78,13 @@ if(RunCMake_GENERATOR STREQUAL "Ninja")
unset(RunCMake_TEST_NO_CLEAN)
endif()
+if(RunCMake_GENERATOR MATCHES "^Visual Studio 8 2005")
+ set(RunCMake_WARN_VS8 1)
+ run_cmake(DeprecateVS8-WARN-ON)
+ unset(RunCMake_WARN_VS8)
+ run_cmake(DeprecateVS8-WARN-OFF)
+endif()
+
if(UNIX)
run_cmake_command(E_create_symlink-no-arg
${CMAKE_COMMAND} -E create_symlink
diff --git a/Tests/RunCMake/Ninja/AssumedSources.cmake b/Tests/RunCMake/Ninja/AssumedSources.cmake
new file mode 100644
index 0000000..5fb0219
--- /dev/null
+++ b/Tests/RunCMake/Ninja/AssumedSources.cmake
@@ -0,0 +1,20 @@
+cmake_minimum_required(VERSION 3.8)
+project(AssumedSources)
+
+set_source_files_properties(
+ "${CMAKE_CURRENT_BINARY_DIR}/target.c"
+ "${CMAKE_CURRENT_BINARY_DIR}/target-no-depends.c"
+ PROPERTIES GENERATED 1)
+
+add_executable(working
+ "${CMAKE_CURRENT_BINARY_DIR}/target.c"
+ "${CMAKE_CURRENT_BINARY_DIR}/target-no-depends.c")
+
+add_custom_target(
+ gen-target.c ALL
+ COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${CMAKE_CURRENT_SOURCE_DIR}/dep.c" "${CMAKE_CURRENT_BINARY_DIR}/target.c")
+add_custom_target(
+ gen-target-no-depends.c ALL
+ COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${CMAKE_CURRENT_SOURCE_DIR}/dep.c" "${CMAKE_CURRENT_BINARY_DIR}/target-no-depends.c")
+
+add_dependencies(working gen-target.c)
diff --git a/Tests/RunCMake/Ninja/LooseObjectDepends.cmake b/Tests/RunCMake/Ninja/LooseObjectDepends.cmake
new file mode 100644
index 0000000..360c7ba
--- /dev/null
+++ b/Tests/RunCMake/Ninja/LooseObjectDepends.cmake
@@ -0,0 +1,26 @@
+cmake_minimum_required(VERSION 3.8)
+project(LooseObjectDepends C)
+
+add_custom_command(
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/command.h"
+ COMMAND "${CMAKE_COMMAND}" -E touch
+ "${CMAKE_CURRENT_BINARY_DIR}/command.h"
+ COMMENT "Creating command.h")
+add_custom_target(create-command.h
+ DEPENDS
+ "${CMAKE_CURRENT_BINARY_DIR}/command.h")
+
+add_custom_target(create-target.h
+ BYPRODUCTS "${CMAKE_CURRENT_BINARY_DIR}/target.h"
+ COMMAND "${CMAKE_COMMAND}" -E touch
+ "${CMAKE_CURRENT_BINARY_DIR}/target.h"
+ COMMENT "Creating target.h")
+
+add_library(dep SHARED dep.c)
+add_dependencies(dep create-command.h create-target.h)
+target_include_directories(dep
+ PUBLIC
+ "${CMAKE_CURRENT_BINARY_DIR}")
+
+add_library(top top.c)
+target_link_libraries(top PRIVATE dep)
diff --git a/Tests/RunCMake/Ninja/RunCMakeTest.cmake b/Tests/RunCMake/Ninja/RunCMakeTest.cmake
index 7b4e51e..8c3bc20 100644
--- a/Tests/RunCMake/Ninja/RunCMakeTest.cmake
+++ b/Tests/RunCMake/Ninja/RunCMakeTest.cmake
@@ -73,7 +73,7 @@ run_SubDir()
function(run_ninja dir)
execute_process(
- COMMAND "${RunCMake_MAKE_PROGRAM}"
+ COMMAND "${RunCMake_MAKE_PROGRAM}" ${ARGN}
WORKING_DIRECTORY "${dir}"
OUTPUT_VARIABLE ninja_stdout
ERROR_VARIABLE ninja_stderr
@@ -95,6 +95,39 @@ ${ninja_stderr}
endif()
endfunction(run_ninja)
+function (run_LooseObjectDepends)
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/LooseObjectDepends-build)
+ run_cmake(LooseObjectDepends)
+ run_ninja("${RunCMake_TEST_BINARY_DIR}" "CMakeFiles/top.dir/top.c${CMAKE_C_OUTPUT_EXTENSION}")
+ if (EXISTS "${RunCMake_TEST_BINARY_DIR}/${CMAKE_SHARED_LIBRARY_PREFIX}dep${CMAKE_SHARED_LIBRARY_SUFFIX}")
+ message(FATAL_ERROR
+ "The `dep` library was created when requesting an object file to be "
+ "built; this should no longer be necessary.")
+ endif ()
+ if (EXISTS "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/dep.dir/dep.c${CMAKE_C_OUTPUT_EXTENSION}")
+ message(FATAL_ERROR
+ "The `dep.c` object file was created when requesting an object file to "
+ "be built; this should no longer be necessary.")
+ endif ()
+endfunction ()
+run_LooseObjectDepends()
+
+function (run_AssumedSources)
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/AssumedSources-build)
+ run_cmake(AssumedSources)
+ run_ninja("${RunCMake_TEST_BINARY_DIR}" "target.c")
+ if (NOT EXISTS "${RunCMake_TEST_BINARY_DIR}/target.c")
+ message(FATAL_ERROR
+ "Dependencies for an assumed source did not hook up properly for 'target.c'.")
+ endif ()
+ run_ninja("${RunCMake_TEST_BINARY_DIR}" "target-no-depends.c")
+ if (EXISTS "${RunCMake_TEST_BINARY_DIR}/target-no-depends.c")
+ message(FATAL_ERROR
+ "Dependencies for an assumed source were magically hooked up for 'target-no-depends.c'.")
+ endif ()
+endfunction ()
+run_AssumedSources()
+
function(sleep delay)
execute_process(
COMMAND ${CMAKE_COMMAND} -E sleep ${delay}
diff --git a/Tests/RunCMake/Ninja/dep.c b/Tests/RunCMake/Ninja/dep.c
new file mode 100644
index 0000000..728f031
--- /dev/null
+++ b/Tests/RunCMake/Ninja/dep.c
@@ -0,0 +1,4 @@
+int dep()
+{
+ return 0;
+}
diff --git a/Tests/RunCMake/Ninja/top.c b/Tests/RunCMake/Ninja/top.c
new file mode 100644
index 0000000..4a88eb2
--- /dev/null
+++ b/Tests/RunCMake/Ninja/top.c
@@ -0,0 +1,7 @@
+#include "command.h"
+#include "target.h"
+
+int top()
+{
+ return 0;
+}
diff --git a/Tests/RunCMake/RunCMake.cmake b/Tests/RunCMake/RunCMake.cmake
index 04eadd5..26312c4 100644
--- a/Tests/RunCMake/RunCMake.cmake
+++ b/Tests/RunCMake/RunCMake.cmake
@@ -51,6 +51,9 @@ function(run_cmake test)
if(APPLE)
list(APPEND RunCMake_TEST_OPTIONS -DCMAKE_POLICY_DEFAULT_CMP0025=NEW)
endif()
+ if(RunCMake_GENERATOR MATCHES "^Visual Studio 8 2005" AND NOT RunCMake_WARN_VS8)
+ list(APPEND RunCMake_TEST_OPTIONS -DCMAKE_WARN_VS8=OFF)
+ endif()
if(RunCMake_MAKE_PROGRAM)
list(APPEND RunCMake_TEST_OPTIONS "-DCMAKE_MAKE_PROGRAM=${RunCMake_MAKE_PROGRAM}")
endif()