diff options
Diffstat (limited to 'Tests')
53 files changed, 567 insertions, 70 deletions
diff --git a/Tests/CMakeLib/CMakeLists.txt b/Tests/CMakeLib/CMakeLists.txt index d680205..d1a1df5 100644 --- a/Tests/CMakeLib/CMakeLists.txt +++ b/Tests/CMakeLib/CMakeLists.txt @@ -34,16 +34,6 @@ target_link_libraries(CMakeLibTests CMakeLib) add_executable(testEncoding testEncoding.cxx) target_link_libraries(testEncoding cmsys) -# Xcode 2.x forgets to create the output directory before linking -# the individual architectures. -if(CMAKE_OSX_ARCHITECTURES AND XCODE - AND NOT "${XCODE_VERSION}" MATCHES "^[^12]") - add_custom_command( - TARGET CMakeLibTests - PRE_BUILD COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_CFG_INTDIR}" - ) -endif() - foreach(test ${CMakeLib_TESTS}) add_test(CMakeLib.${test} CMakeLibTests ${test} ${${test}_ARGS}) endforeach() diff --git a/Tests/CMakeLib/PseudoMemcheck/CMakeLists.txt b/Tests/CMakeLib/PseudoMemcheck/CMakeLists.txt index c53befc..7c84ee1 100644 --- a/Tests/CMakeLib/PseudoMemcheck/CMakeLists.txt +++ b/Tests/CMakeLib/PseudoMemcheck/CMakeLists.txt @@ -24,18 +24,3 @@ target_link_libraries(memcheck_fail CMakeLib) # output file. Need to be in their own subdirectory as they have the # same filenames. add_subdirectory(NoLog) - -# Xcode 2.x forgets to create the output directory before linking -# the individual architectures. -if(CMAKE_OSX_ARCHITECTURES AND XCODE AND NOT "${XCODE_VERSION}" MATCHES "^[^12]") - foreach(t - memcheck_fail - pseudo_BC - pseudo_purify - pseudo_valgrind - ) - add_custom_command(TARGET ${t} - PRE_BUILD COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_CFG_INTDIR}" - ) - endforeach() -endif() diff --git a/Tests/CMakeLib/PseudoMemcheck/NoLog/CMakeLists.txt b/Tests/CMakeLib/PseudoMemcheck/NoLog/CMakeLists.txt index 3a45bfe..e47b9db 100644 --- a/Tests/CMakeLib/PseudoMemcheck/NoLog/CMakeLists.txt +++ b/Tests/CMakeLib/PseudoMemcheck/NoLog/CMakeLists.txt @@ -11,12 +11,4 @@ configure_file( foreach(_pseudo IN ITEMS valgrind purify BC) add_executable(pseudonl_${_pseudo} "${CMAKE_CURRENT_BINARY_DIR}/ret0.c") set_target_properties(pseudonl_${_pseudo} PROPERTIES OUTPUT_NAME ${_pseudo}) - - # Xcode 2.x forgets to create the output directory before linking - # the individual architectures. - if(CMAKE_OSX_ARCHITECTURES AND XCODE AND NOT "${XCODE_VERSION}" MATCHES "^[^12]") - add_custom_command(TARGET pseudonl_${_pseudo} - PRE_BUILD COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_CFG_INTDIR}" - ) - endif() endforeach() diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 60a2cbb..2f53cfc9 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -1421,6 +1421,10 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release add_subdirectory(FindOpenGL) endif() + if(CMake_TEST_FindOpenMP) + add_subdirectory(FindOpenMP) + endif() + if(CMake_TEST_FindOpenSSL) add_subdirectory(FindOpenSSL) endif() 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/CudaOnly/CMakeLists.txt b/Tests/CudaOnly/CMakeLists.txt index 85a2051..a3bd707 100644 --- a/Tests/CudaOnly/CMakeLists.txt +++ b/Tests/CudaOnly/CMakeLists.txt @@ -1,4 +1,5 @@ ADD_TEST_MACRO(CudaOnly.EnableStandard CudaOnlyEnableStandard) +ADD_TEST_MACRO(CudaOnly.ExportPTX CudaOnlyExportPTX) ADD_TEST_MACRO(CudaOnly.SeparateCompilation CudaOnlySeparateCompilation) ADD_TEST_MACRO(CudaOnly.WithDefs CudaOnlyWithDefs) diff --git a/Tests/CudaOnly/ExportPTX/CMakeLists.txt b/Tests/CudaOnly/ExportPTX/CMakeLists.txt new file mode 100644 index 0000000..10249c6 --- /dev/null +++ b/Tests/CudaOnly/ExportPTX/CMakeLists.txt @@ -0,0 +1,82 @@ +cmake_minimum_required(VERSION 3.8) +project (CudaOnlyExportPTX CUDA) + +#Goal for this example: +# How to generate PTX files instead of OBJECT files +# How to reference PTX files for custom commands +# How to install PTX files + +add_library(CudaPTX OBJECT kernelA.cu kernelB.cu) +set_property(TARGET CudaPTX PROPERTY CUDA_PTX_COMPILATION ON) + +#Test ObjectFiles with file(GENERATE) +file(GENERATE + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/gen_$<LOWER_CASE:$<CONFIG>/>path_to_objs.h + CONTENT [[ + +#include <vector> +#include <string> + +#ifndef path_to_objs +#define path_to_objs + +static std::string ptx_paths = "$<TARGET_OBJECTS:CudaPTX>"; + +#endif + +]] +) +#We are going to need a wrapper around bin2c for multiple reasons +# 1. bin2c only converts a single file at a time +# 2. bin2c has only standard out support, so we have to manually +# redirect to a cmake buffer +# 3. We want to pack everything into a single output file, so we +# need to also pass the --name option +set(output_file ${CMAKE_CURRENT_BINARY_DIR}/embedded_objs.h) + +get_filename_component(cuda_compiler_bin "${CMAKE_CUDA_COMPILER}" DIRECTORY) +find_program(bin_to_c + NAMES bin2c + PATHS ${cuda_compiler_bin} + ) +if(NOT bin_to_c) + message(FATAL_ERROR + "bin2c not found:\n" + " CMAKE_CUDA_COMPILER='${CMAKE_CUDA_COMPILER}'\n" + " cuda_compiler_bin='${cuda_compiler_bin}'\n" + ) +endif() + +add_custom_command( + OUTPUT "${output_file}" + COMMAND ${CMAKE_COMMAND} + "-DBIN_TO_C_COMMAND=${bin_to_c}" + "-DOBJECTS=$<TARGET_OBJECTS:CudaPTX>" + "-DOUTPUT=${output_file}" + -P ${CMAKE_CURRENT_SOURCE_DIR}/bin2c_wrapper.cmake + VERBATIM + DEPENDS $<TARGET_OBJECTS:CudaPTX> + COMMENT "Converting Object files to a C header" + ) + +add_executable(CudaOnlyExportPTX main.cu ${output_file}) +add_dependencies(CudaOnlyExportPTX CudaPTX) +target_include_directories(CudaOnlyExportPTX PRIVATE + ${CMAKE_CURRENT_BINARY_DIR} ) +target_compile_definitions(CudaOnlyExportPTX PRIVATE + "CONFIG_TYPE=gen_$<LOWER_CASE:$<CONFIG>>") + +if(APPLE) + # We need to add the default path to the driver (libcuda.dylib) as an rpath, so that + # the static cuda runtime can find it at runtime. + target_link_libraries(CudaOnlyExportPTX PRIVATE -Wl,-rpath,/usr/local/cuda/lib) +endif() + +#Verify that we can install object targets properly +install(TARGETS CudaPTX CudaOnlyExportPTX + EXPORT cudaPTX + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + OBJECTS DESTINATION objs + ) +install(EXPORT cudaPTX DESTINATION lib/cudaPTX) diff --git a/Tests/CudaOnly/ExportPTX/bin2c_wrapper.cmake b/Tests/CudaOnly/ExportPTX/bin2c_wrapper.cmake new file mode 100644 index 0000000..0baf934 --- /dev/null +++ b/Tests/CudaOnly/ExportPTX/bin2c_wrapper.cmake @@ -0,0 +1,19 @@ + +set(file_contents) +foreach(obj ${OBJECTS}) + get_filename_component(obj_ext ${obj} EXT) + get_filename_component(obj_name ${obj} NAME_WE) + get_filename_component(obj_dir ${obj} DIRECTORY) + + if(obj_ext MATCHES ".ptx") + set(args --name ${obj_name} ${obj}) + execute_process(COMMAND "${BIN_TO_C_COMMAND}" ${args} + WORKING_DIRECTORY ${obj_dir} + RESULT_VARIABLE result + OUTPUT_VARIABLE output + ERROR_VARIABLE error_var + ) + set(file_contents "${file_contents} \n${output}") + endif() +endforeach() +file(WRITE "${OUTPUT}" "${file_contents}") diff --git a/Tests/CudaOnly/ExportPTX/kernelA.cu b/Tests/CudaOnly/ExportPTX/kernelA.cu new file mode 100644 index 0000000..fbe0d26 --- /dev/null +++ b/Tests/CudaOnly/ExportPTX/kernelA.cu @@ -0,0 +1,7 @@ + +__global__ void kernelA(float* r, float* x, float* y, float* z, int size) +{ + for (int i = threadIdx.x; i < size; i += blockDim.x) { + r[i] = x[i] * y[i] + z[i]; + } +} diff --git a/Tests/CudaOnly/ExportPTX/kernelB.cu b/Tests/CudaOnly/ExportPTX/kernelB.cu new file mode 100644 index 0000000..11872e4 --- /dev/null +++ b/Tests/CudaOnly/ExportPTX/kernelB.cu @@ -0,0 +1,8 @@ + + +__global__ void kernelB(float* r, float* x, float* y, float* z, int size) +{ + for (int i = threadIdx.x; i < size; i += blockDim.x) { + r[i] = x[i] * y[i] + z[i]; + } +} diff --git a/Tests/CudaOnly/ExportPTX/main.cu b/Tests/CudaOnly/ExportPTX/main.cu new file mode 100644 index 0000000..132377c --- /dev/null +++ b/Tests/CudaOnly/ExportPTX/main.cu @@ -0,0 +1,28 @@ + +#include <iostream> + +/* + Define GENERATED_HEADER macro to allow c++ files to include headers + generated based on different configuration types. +*/ + +/* clang-format off */ +#define GENERATED_HEADER(x) GENERATED_HEADER0(CONFIG_TYPE/x) +/* clang-format on */ +#define GENERATED_HEADER0(x) GENERATED_HEADER1(x) +#define GENERATED_HEADER1(x) <x> + +#include GENERATED_HEADER(path_to_objs.h) + +#include "embedded_objs.h" + +int main(int argc, char** argv) +{ + (void)argc; + (void)argv; + + unsigned char* ka = kernelA; + unsigned char* kb = kernelB; + + return (ka != NULL && kb != NULL) ? 0 : 1; +} 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/FindOpenMP/CMakeLists.txt b/Tests/FindOpenMP/CMakeLists.txt new file mode 100644 index 0000000..e64885d --- /dev/null +++ b/Tests/FindOpenMP/CMakeLists.txt @@ -0,0 +1,21 @@ +foreach(c C CXX Fortran) + if(CMake_TEST_FindOpenMP_${c}) + set(CMake_TEST_FindOpenMP_FLAG_${c} 1) + else() + set(CMake_TEST_FindOpenMP_FLAG_${c} 0) + endif() +endforeach() + +add_test(NAME FindOpenMP.Test COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindOpenMP/Test" + "${CMake_BINARY_DIR}/Tests/FindOpenMP/Test" + ${build_generator_args} + --build-project TestFindOpenMP + --build-options ${build_options} + -DOpenMP_TEST_C=${CMake_TEST_FindOpenMP_FLAG_C} + -DOpenMP_TEST_CXX=${CMake_TEST_FindOpenMP_FLAG_CXX} + -DOpenMP_TEST_Fortran=${CMake_TEST_FindOpenMP_FLAG_Fortran} + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> + ) diff --git a/Tests/FindOpenMP/Test/CMakeLists.txt b/Tests/FindOpenMP/Test/CMakeLists.txt new file mode 100644 index 0000000..4ba0e5c --- /dev/null +++ b/Tests/FindOpenMP/Test/CMakeLists.txt @@ -0,0 +1,73 @@ +cmake_minimum_required(VERSION 3.8) +project(TestFindOpenMP) +include(CTest) + +macro(source_code_mapper_helper LANG_NAME SRC_FILE_NAME) + if("${LANG_NAME}" STREQUAL "C") + set(OpenMPTEST_SOURCE_FILE "${SRC_FILE_NAME}.c") + elseif("${LANG_NAME}" STREQUAL "CXX") + configure_file("${SRC_FILE_NAME}.c" "${SRC_FILE_NAME}.cxx" COPYONLY) + set(OpenMPTEST_SOURCE_FILE "${SRC_FILE_NAME}.cxx") + elseif("${LANG_NAME}" STREQUAL "Fortran") + set(OpenMPTEST_SOURCE_FILE "${CMAKE_CURRENT_BINARY_DIR}/${SRC_FILE_NAME}.f90") + if(OpenMP_Fortran_HAVE_OMPLIB_MODULE) + set(OpenMP_Fortran_INCLUDE_LINE "use omp_lib\n implicit none") + else() + set(OpenMP_Fortran_INCLUDE_LINE "implicit none\n include 'omp_lib.h'") + endif() + configure_file("${SRC_FILE_NAME}.f90.in" "${OpenMPTEST_SOURCE_FILE}" @ONLY) + endif() +endmacro() + +foreach(c C CXX Fortran) + if("${OpenMP_TEST_${c}}") + message("Testing ${c}") + enable_language(${c}) + endif() +endforeach() + +find_package(OpenMP REQUIRED) + +foreach(c C CXX Fortran) + if(NOT "${OpenMP_TEST_${c}}") + continue() + endif() + source_code_mapper_helper(${c} main) + add_executable(test_tgt_${c} ${OpenMPTEST_SOURCE_FILE}) + target_link_libraries(test_tgt_${c} PRIVATE OpenMP::OpenMP_${c}) + set_property(TARGET test_tgt_${c} PROPERTY LINKER_LANGUAGE ${c}) + add_test(NAME test_tgt_${c} COMMAND test_tgt_${c}) + + add_executable(test_var_${c} ${OpenMPTEST_SOURCE_FILE}) + if(CMAKE_HOST_WIN32) + separate_arguments(_OpenMP_${c}_OPTIONS WINDOWS_COMMAND "${OpenMP_${c}_FLAGS}") + else() + separate_arguments(_OpenMP_${c}_OPTIONS UNIX_COMMAND "${OpenMP_${c}_FLAGS}") + endif() + target_compile_options(test_var_${c} PRIVATE "${_OpenMP_${c}_OPTIONS}") + target_link_libraries(test_var_${c} PRIVATE "${OpenMP_${c}_FLAGS}") + set_property(TARGET test_var_${c} PROPERTY LINKER_LANGUAGE ${c}) + add_test(NAME test_var_${c} COMMAND test_var_${c}) + + source_code_mapper_helper(${c} scalprod) + add_library(scalprod_${c} STATIC ${OpenMPTEST_SOURCE_FILE}) + target_link_libraries(scalprod_${c} PRIVATE OpenMP::OpenMP_${c}) + set_property(TARGET scalprod_${c} PROPERTY LINKER_LANGUAGE ${c}) +endforeach() + +foreach(c C CXX Fortran) + if(NOT "${OpenMP_TEST_${c}}") + continue() + endif() + foreach(d C CXX Fortran) + if(NOT "${OpenMP_TEST_${d}}") + continue() + endif() + source_code_mapper_helper(${c} scaltest) + add_executable(scaltest_${c}_${d} ${OpenMPTEST_SOURCE_FILE}) + target_link_libraries(scaltest_${c}_${d} PRIVATE scalprod_${d}) + set_property(TARGET scaltest_${c}_${d} PROPERTY LINKER_LANGUAGE ${c}) + add_test(NAME test_omp_${c}_${d} COMMAND scaltest_${c}_${d}) + set_property(TEST test_omp_${c}_${d} PROPERTY PASS_REGULAR_EXPRESSION "^[ \t]*70\\.?0*") + endforeach() +endforeach() diff --git a/Tests/FindOpenMP/Test/main.c b/Tests/FindOpenMP/Test/main.c new file mode 100644 index 0000000..4f0e874 --- /dev/null +++ b/Tests/FindOpenMP/Test/main.c @@ -0,0 +1,7 @@ +#include <omp.h> +int main() +{ +#ifndef _OPENMP + breaks_on_purpose +#endif +} diff --git a/Tests/FindOpenMP/Test/main.f90.in b/Tests/FindOpenMP/Test/main.f90.in new file mode 100644 index 0000000..9da22a1 --- /dev/null +++ b/Tests/FindOpenMP/Test/main.f90.in @@ -0,0 +1,5 @@ + program test + @OpenMP_Fortran_INCLUDE_LINE@ + !$ integer :: n + n = omp_get_num_threads() + end program test diff --git a/Tests/FindOpenMP/Test/scalprod.c b/Tests/FindOpenMP/Test/scalprod.c new file mode 100644 index 0000000..24c4587 --- /dev/null +++ b/Tests/FindOpenMP/Test/scalprod.c @@ -0,0 +1,16 @@ +#include <omp.h> + +#ifdef __cplusplus +extern "C" +#endif + void + scalprod(int n, double* x, double* y, double* res) +{ + int i; + double res_v = 0.; +#pragma omp parallel for reduction(+ : res_v) + for (i = 0; i < n; ++i) { + res_v += x[i] * y[i]; + } + *res = res_v; +} diff --git a/Tests/FindOpenMP/Test/scalprod.f90.in b/Tests/FindOpenMP/Test/scalprod.f90.in new file mode 100644 index 0000000..efc7ea0 --- /dev/null +++ b/Tests/FindOpenMP/Test/scalprod.f90.in @@ -0,0 +1,19 @@ +subroutine scalprod(n, x_p, y_p, res) bind(c) + use iso_c_binding + implicit none + integer(c_int), intent(in), value :: n + type(c_ptr), intent(in), value :: x_p, y_p + real(c_double), pointer :: x(:), y(:) + integer :: i + + real(c_double) :: res + real(c_double) :: scalpt = 0 + call c_f_pointer(x_p, x, shape=[n]) + call c_f_pointer(y_p, y, shape=[n]) + res = 0 +!$omp parallel do private(scalpt), reduction(+:res) + do i=1,n + scalpt = y(i) * x(i) + res = res + scalpt + end do +end subroutine scalprod diff --git a/Tests/FindOpenMP/Test/scaltest.c b/Tests/FindOpenMP/Test/scaltest.c new file mode 100644 index 0000000..2ee57f8 --- /dev/null +++ b/Tests/FindOpenMP/Test/scaltest.c @@ -0,0 +1,20 @@ +#ifdef __cplusplus +#include <iostream> +extern "C" +#else +#include <stdio.h> +#endif +int scalprod(int n, double* x, double* y, double* res); + +int main() +{ + double a[5] = { 1., 2., 3., 4., 5. }; + double b[5] = { 2., 3., 4., 5., 6. }; + double rk; + scalprod(5, a, b, &rk); +#ifdef __cplusplus + std::cout << rk << std::endl; +#else + printf("%f\n", rk); +#endif +} diff --git a/Tests/FindOpenMP/Test/scaltest.f90.in b/Tests/FindOpenMP/Test/scaltest.f90.in new file mode 100644 index 0000000..64c20d2 --- /dev/null +++ b/Tests/FindOpenMP/Test/scaltest.f90.in @@ -0,0 +1,21 @@ +program scaltest + use iso_c_binding + implicit none + interface + subroutine scalprod(n, x_p, y_p, res) bind(c) + use iso_c_binding + integer(c_int), value :: n + type(c_ptr), value :: x_p, y_p + real(c_double) :: res + end subroutine scalprod + end interface + type(c_ptr) :: x_pt, y_pt + real(c_double), dimension(5), target :: a = (/ 1, 2, 3, 4, 5 /) + real(c_double), dimension(5), target :: b = (/ 2, 3, 4, 5, 6 /) + integer(c_int) :: n = size(a) + real(c_double) :: res + x_pt = c_loc(a) + y_pt = c_loc(b) + call scalprod(n, x_pt, y_pt, res) + print *, res +end program scaltest 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/CMP0019/CMP0019-OLD-stderr.txt b/Tests/RunCMake/CMP0019/CMP0019-OLD-stderr.txt new file mode 100644 index 0000000..048762d --- /dev/null +++ b/Tests/RunCMake/CMP0019/CMP0019-OLD-stderr.txt @@ -0,0 +1,10 @@ +^CMake Deprecation Warning at CMP0019-OLD.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0019 will be removed from a future version + of CMake. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/CMP0026/CMP0026-CONFIG-LOCATION-OLD-stderr.txt b/Tests/RunCMake/CMP0026/CMP0026-CONFIG-LOCATION-OLD-stderr.txt new file mode 100644 index 0000000..edeb337 --- /dev/null +++ b/Tests/RunCMake/CMP0026/CMP0026-CONFIG-LOCATION-OLD-stderr.txt @@ -0,0 +1,10 @@ +^CMake Deprecation Warning at CMP0026-CONFIG-LOCATION-OLD.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0026 will be removed from a future version + of CMake. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/CMP0026/CMP0026-LOCATION-CONFIG-OLD-stderr.txt b/Tests/RunCMake/CMP0026/CMP0026-LOCATION-CONFIG-OLD-stderr.txt new file mode 100644 index 0000000..32ff698 --- /dev/null +++ b/Tests/RunCMake/CMP0026/CMP0026-LOCATION-CONFIG-OLD-stderr.txt @@ -0,0 +1,10 @@ +^CMake Deprecation Warning at CMP0026-LOCATION-CONFIG-OLD.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0026 will be removed from a future version + of CMake. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/CMP0026/CMP0026-OLD-stderr.txt b/Tests/RunCMake/CMP0026/CMP0026-OLD-stderr.txt new file mode 100644 index 0000000..b3f79fc --- /dev/null +++ b/Tests/RunCMake/CMP0026/CMP0026-OLD-stderr.txt @@ -0,0 +1,10 @@ +^CMake Deprecation Warning at CMP0026-OLD.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0026 will be removed from a future version + of CMake. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/CMP0026/clear-cached-information-stderr.txt b/Tests/RunCMake/CMP0026/clear-cached-information-stderr.txt new file mode 100644 index 0000000..157a046 --- /dev/null +++ b/Tests/RunCMake/CMP0026/clear-cached-information-stderr.txt @@ -0,0 +1,10 @@ +^CMake Deprecation Warning at clear-cached-information.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0026 will be removed from a future version + of CMake. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/CMP0028/CMP0028-OLD-iface-stderr.txt b/Tests/RunCMake/CMP0028/CMP0028-OLD-iface-stderr.txt new file mode 100644 index 0000000..b7a0755 --- /dev/null +++ b/Tests/RunCMake/CMP0028/CMP0028-OLD-iface-stderr.txt @@ -0,0 +1,10 @@ +^CMake Deprecation Warning at CMP0028-OLD-iface.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0028 will be removed from a future version + of CMake. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/CMP0028/CMP0028-OLD-stderr.txt b/Tests/RunCMake/CMP0028/CMP0028-OLD-stderr.txt new file mode 100644 index 0000000..586a876 --- /dev/null +++ b/Tests/RunCMake/CMP0028/CMP0028-OLD-stderr.txt @@ -0,0 +1,10 @@ +^CMake Deprecation Warning at CMP0028-OLD.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0028 will be removed from a future version + of CMake. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 32c4be8..7db5243 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -63,15 +63,6 @@ if(XCODE_VERSION AND "${XCODE_VERSION}" VERSION_LESS 6.1) set(Swift_ARGS -DXCODE_BELOW_6_1=1) endif() -if(XCODE_VERSION AND "${XCODE_VERSION}" VERSION_LESS 3) - set(GeneratorToolset_ARGS -DXCODE_BELOW_3=1) -endif() - -if(XCODE_VERSION AND "${XCODE_VERSION}" VERSION_LESS 2) - set(TargetSources_ARGS -DXCODE_BELOW_2=1) - set(File_Generate_ARGS -DXCODE_BELOW_2=1) -endif() - # Test MSVC for older host CMake versions, and test # WIN32/CMAKE_C_COMPILER_ID to fix check on Intel for Windows. if(MSVC OR (WIN32 AND CMAKE_C_COMPILER_ID MATCHES "MSVC|Intel")) @@ -119,6 +110,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) @@ -280,7 +275,7 @@ if("${CMAKE_GENERATOR}" MATCHES "Visual Studio ([^89]|[89][0-9])") add_RunCMake_test(VS10Project) endif() -if(XCODE_VERSION AND NOT "${XCODE_VERSION}" VERSION_LESS 3) +if(XCODE_VERSION) add_RunCMake_test(XcodeProject -DXCODE_VERSION=${XCODE_VERSION}) endif() @@ -328,19 +323,6 @@ add_executable(pseudo_emulator_custom_command pseudo_emulator_custom_command.c) add_RunCMake_test(CrosscompilingEmulator -DPSEUDO_EMULATOR=$<TARGET_FILE:pseudo_emulator> -DPSEUDO_EMULATOR_CUSTOM_COMMAND=$<TARGET_FILE:pseudo_emulator_custom_command>) -# Xcode 2.x forgets to create the output directory before linking -# the individual architectures. -if(CMAKE_OSX_ARCHITECTURES AND XCODE AND NOT "${XCODE_VERSION}" MATCHES "^[^12]") - add_custom_command( - TARGET pseudo_emulator - PRE_BUILD COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_CFG_INTDIR}" - ) - add_custom_command( - TARGET pseudo_emulator_custom_command - PRE_BUILD COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_CFG_INTDIR}" - ) -endif() - if("${CMAKE_GENERATOR}" MATCHES "Make|Ninja") if(UNIX AND NOT CYGWIN) execute_process(COMMAND ldd --help 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/DisallowedCommands/CMP0029-OLD-stderr.txt b/Tests/RunCMake/DisallowedCommands/CMP0029-OLD-stderr.txt new file mode 100644 index 0000000..430c865 --- /dev/null +++ b/Tests/RunCMake/DisallowedCommands/CMP0029-OLD-stderr.txt @@ -0,0 +1,10 @@ +^CMake Deprecation Warning at CMP0029-OLD.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0029 will be removed from a future version + of CMake. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/DisallowedCommands/CMP0030-OLD-stderr.txt b/Tests/RunCMake/DisallowedCommands/CMP0030-OLD-stderr.txt index e95e16f..d00b827 100644 --- a/Tests/RunCMake/DisallowedCommands/CMP0030-OLD-stderr.txt +++ b/Tests/RunCMake/DisallowedCommands/CMP0030-OLD-stderr.txt @@ -1,4 +1,15 @@ -^CMake Error at CMP0030-OLD.cmake:2 \(use_mangled_mesa\): +^CMake Deprecation Warning at CMP0030-OLD.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0030 will be removed from a future version + of CMake. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) ++ +CMake Error at CMP0030-OLD.cmake:2 \(use_mangled_mesa\): use_mangled_mesa called with incorrect number of arguments Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/File_Generate/RunCMakeTest.cmake b/Tests/RunCMake/File_Generate/RunCMakeTest.cmake index db344ef..82e903d 100644 --- a/Tests/RunCMake/File_Generate/RunCMakeTest.cmake +++ b/Tests/RunCMake/File_Generate/RunCMakeTest.cmake @@ -1,7 +1,7 @@ include(RunCMake) run_cmake(CommandConflict) -if("${RunCMake_GENERATOR}" MATCHES "Visual Studio|Xcode" AND NOT XCODE_BELOW_2) +if("${RunCMake_GENERATOR}" MATCHES "Visual Studio|Xcode") run_cmake(OutputConflict) endif() run_cmake(EmptyCondition1) diff --git a/Tests/RunCMake/GNUInstallDirs/Common.cmake b/Tests/RunCMake/GNUInstallDirs/Common.cmake index eff2d54..5f119af 100644 --- a/Tests/RunCMake/GNUInstallDirs/Common.cmake +++ b/Tests/RunCMake/GNUInstallDirs/Common.cmake @@ -15,6 +15,7 @@ set(dirs LIBEXECDIR LOCALEDIR LOCALSTATEDIR + RUNSTATEDIR MANDIR SBINDIR SHAREDSTATEDIR diff --git a/Tests/RunCMake/GNUInstallDirs/Opt-stderr.txt b/Tests/RunCMake/GNUInstallDirs/Opt-stderr.txt index aee8552..3e18410 100644 --- a/Tests/RunCMake/GNUInstallDirs/Opt-stderr.txt +++ b/Tests/RunCMake/GNUInstallDirs/Opt-stderr.txt @@ -8,6 +8,7 @@ CMAKE_INSTALL_LIBDIR='(lib|lib64)' CMAKE_INSTALL_LIBEXECDIR='libexec' CMAKE_INSTALL_LOCALEDIR='share/locale' CMAKE_INSTALL_LOCALSTATEDIR='var' +CMAKE_INSTALL_RUNSTATEDIR='var/run' CMAKE_INSTALL_MANDIR='share/man' CMAKE_INSTALL_SBINDIR='sbin' CMAKE_INSTALL_SHAREDSTATEDIR='com' @@ -22,6 +23,7 @@ CMAKE_INSTALL_FULL_LIBDIR='/opt/Opt/(lib|lib64)' CMAKE_INSTALL_FULL_LIBEXECDIR='/opt/Opt/libexec' CMAKE_INSTALL_FULL_LOCALEDIR='/opt/Opt/share/locale' CMAKE_INSTALL_FULL_LOCALSTATEDIR='/var/opt/Opt' +CMAKE_INSTALL_FULL_RUNSTATEDIR='/var/run/opt/Opt' CMAKE_INSTALL_FULL_MANDIR='/opt/Opt/share/man' CMAKE_INSTALL_FULL_SBINDIR='/opt/Opt/sbin' CMAKE_INSTALL_FULL_SHAREDSTATEDIR='/opt/Opt/com' diff --git a/Tests/RunCMake/GNUInstallDirs/Root-stderr.txt b/Tests/RunCMake/GNUInstallDirs/Root-stderr.txt index a95400e..8c13368 100644 --- a/Tests/RunCMake/GNUInstallDirs/Root-stderr.txt +++ b/Tests/RunCMake/GNUInstallDirs/Root-stderr.txt @@ -8,6 +8,7 @@ CMAKE_INSTALL_LIBDIR='usr/(lib|lib64)' CMAKE_INSTALL_LIBEXECDIR='usr/libexec' CMAKE_INSTALL_LOCALEDIR='usr/share/locale' CMAKE_INSTALL_LOCALSTATEDIR='var' +CMAKE_INSTALL_RUNSTATEDIR='var/run' CMAKE_INSTALL_MANDIR='usr/share/man' CMAKE_INSTALL_SBINDIR='usr/sbin' CMAKE_INSTALL_SHAREDSTATEDIR='usr/com' @@ -22,6 +23,7 @@ CMAKE_INSTALL_FULL_LIBDIR='/usr/(lib|lib64)' CMAKE_INSTALL_FULL_LIBEXECDIR='/usr/libexec' CMAKE_INSTALL_FULL_LOCALEDIR='/usr/share/locale' CMAKE_INSTALL_FULL_LOCALSTATEDIR='/var' +CMAKE_INSTALL_FULL_RUNSTATEDIR='/var/run' CMAKE_INSTALL_FULL_MANDIR='/usr/share/man' CMAKE_INSTALL_FULL_SBINDIR='/usr/sbin' CMAKE_INSTALL_FULL_SHAREDSTATEDIR='/usr/com' diff --git a/Tests/RunCMake/GNUInstallDirs/Usr-stderr.txt b/Tests/RunCMake/GNUInstallDirs/Usr-stderr.txt index e10c4c5..a591436 100644 --- a/Tests/RunCMake/GNUInstallDirs/Usr-stderr.txt +++ b/Tests/RunCMake/GNUInstallDirs/Usr-stderr.txt @@ -8,6 +8,7 @@ CMAKE_INSTALL_LIBDIR='(lib|lib64|lib/arch)' CMAKE_INSTALL_LIBEXECDIR='libexec' CMAKE_INSTALL_LOCALEDIR='share/locale' CMAKE_INSTALL_LOCALSTATEDIR='var' +CMAKE_INSTALL_RUNSTATEDIR='var/run' CMAKE_INSTALL_MANDIR='share/man' CMAKE_INSTALL_SBINDIR='sbin' CMAKE_INSTALL_SHAREDSTATEDIR='com' @@ -22,6 +23,7 @@ CMAKE_INSTALL_FULL_LIBDIR='/usr/(lib|lib64|lib/arch)' CMAKE_INSTALL_FULL_LIBEXECDIR='/usr/libexec' CMAKE_INSTALL_FULL_LOCALEDIR='/usr/share/locale' CMAKE_INSTALL_FULL_LOCALSTATEDIR='/var' +CMAKE_INSTALL_FULL_RUNSTATEDIR='/var/run' CMAKE_INSTALL_FULL_MANDIR='/usr/share/man' CMAKE_INSTALL_FULL_SBINDIR='/usr/sbin' CMAKE_INSTALL_FULL_SHAREDSTATEDIR='/usr/com' diff --git a/Tests/RunCMake/GNUInstallDirs/UsrLocal-stderr.txt b/Tests/RunCMake/GNUInstallDirs/UsrLocal-stderr.txt index 8dcf25b..f957e0e 100644 --- a/Tests/RunCMake/GNUInstallDirs/UsrLocal-stderr.txt +++ b/Tests/RunCMake/GNUInstallDirs/UsrLocal-stderr.txt @@ -8,6 +8,7 @@ CMAKE_INSTALL_LIBDIR='(lib|lib64)' CMAKE_INSTALL_LIBEXECDIR='libexec' CMAKE_INSTALL_LOCALEDIR='share/locale' CMAKE_INSTALL_LOCALSTATEDIR='var' +CMAKE_INSTALL_RUNSTATEDIR='var/run' CMAKE_INSTALL_MANDIR='share/man' CMAKE_INSTALL_SBINDIR='sbin' CMAKE_INSTALL_SHAREDSTATEDIR='com' @@ -22,6 +23,7 @@ CMAKE_INSTALL_FULL_LIBDIR='/usr/local/(lib|lib64)' CMAKE_INSTALL_FULL_LIBEXECDIR='/usr/local/libexec' CMAKE_INSTALL_FULL_LOCALEDIR='/usr/local/share/locale' CMAKE_INSTALL_FULL_LOCALSTATEDIR='/usr/local/var' +CMAKE_INSTALL_FULL_RUNSTATEDIR='/usr/local/var/run' CMAKE_INSTALL_FULL_MANDIR='/usr/local/share/man' CMAKE_INSTALL_FULL_SBINDIR='/usr/local/sbin' CMAKE_INSTALL_FULL_SHAREDSTATEDIR='/usr/local/com' diff --git a/Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake index f6449f2..f89100e 100644 --- a/Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake +++ b/Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake @@ -31,7 +31,7 @@ if("${RunCMake_GENERATOR}" MATCHES "Visual Studio 1[01245]") endif() set(RunCMake_GENERATOR_TOOLSET "Test Toolset,not_a_key") run_cmake(BadToolsetFormat) -elseif("${RunCMake_GENERATOR}" STREQUAL "Xcode" AND NOT XCODE_BELOW_3) +elseif("${RunCMake_GENERATOR}" STREQUAL "Xcode") set(RunCMake_GENERATOR_TOOLSET "Test Toolset") run_cmake(TestToolset) set(RunCMake_GENERATOR_TOOLSET "Test Toolset,host=x64") @@ -47,7 +47,7 @@ set(RunCMake_TEST_OPTIONS -T "Extra Toolset") run_cmake(TwoToolsets) unset(RunCMake_TEST_OPTIONS) -if("${RunCMake_GENERATOR}" MATCHES "Visual Studio 1[01245]|Xcode" AND NOT XCODE_BELOW_3) +if("${RunCMake_GENERATOR}" MATCHES "Visual Studio 1[01245]|Xcode") set(RunCMake_TEST_OPTIONS -DCMAKE_TOOLCHAIN_FILE=${RunCMake_SOURCE_DIR}/TestToolset-toolchain.cmake) run_cmake(TestToolsetToolchain) unset(RunCMake_TEST_OPTIONS) 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() diff --git a/Tests/RunCMake/TargetSources/CMP0026-LOCATION-stderr.txt b/Tests/RunCMake/TargetSources/CMP0026-LOCATION-stderr.txt new file mode 100644 index 0000000..d7ccedb --- /dev/null +++ b/Tests/RunCMake/TargetSources/CMP0026-LOCATION-stderr.txt @@ -0,0 +1,10 @@ +^CMake Deprecation Warning at CMP0026-LOCATION.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0026 will be removed from a future version + of CMake. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/TargetSources/RunCMakeTest.cmake b/Tests/RunCMake/TargetSources/RunCMakeTest.cmake index 4416ef9..bb55a6e 100644 --- a/Tests/RunCMake/TargetSources/RunCMakeTest.cmake +++ b/Tests/RunCMake/TargetSources/RunCMakeTest.cmake @@ -1,6 +1,6 @@ include(RunCMake) -if(RunCMake_GENERATOR MATCHES "Visual Studio|Xcode" AND NOT XCODE_BELOW_2) +if(RunCMake_GENERATOR MATCHES "Visual Studio|Xcode") run_cmake(ConfigNotAllowed) run_cmake(OriginDebugIDE) else() |