diff options
Diffstat (limited to 'Tests/RunCMake/VS10Project')
-rw-r--r-- | Tests/RunCMake/VS10Project/InterfaceLibSources-check.cmake | 25 | ||||
-rw-r--r-- | Tests/RunCMake/VS10Project/InterfaceLibSources.cmake | 1 | ||||
-rw-r--r-- | Tests/RunCMake/VS10Project/LanguageStandard-check.cmake | 23 | ||||
-rw-r--r-- | Tests/RunCMake/VS10Project/LanguageStandard.cmake | 5 | ||||
-rw-r--r-- | Tests/RunCMake/VS10Project/NoImpLib-check.cmake | 23 | ||||
-rw-r--r-- | Tests/RunCMake/VS10Project/NoImpLib.cmake | 3 | ||||
-rw-r--r-- | Tests/RunCMake/VS10Project/RunCMakeTest.cmake | 6 | ||||
-rw-r--r-- | Tests/RunCMake/VS10Project/VsPlatformToolset-check.cmake | 2 | ||||
-rw-r--r-- | Tests/RunCMake/VS10Project/iface.h | 0 |
9 files changed, 87 insertions, 1 deletions
diff --git a/Tests/RunCMake/VS10Project/InterfaceLibSources-check.cmake b/Tests/RunCMake/VS10Project/InterfaceLibSources-check.cmake new file mode 100644 index 0000000000..bcdc10105d --- /dev/null +++ b/Tests/RunCMake/VS10Project/InterfaceLibSources-check.cmake @@ -0,0 +1,25 @@ +set(vcProjectFile "${RunCMake_TEST_BINARY_DIR}/iface.vcxproj") +if(NOT EXISTS "${vcProjectFile}") + set(RunCMake_TEST_FAILED "Project file ${vcProjectFile} does not exist.") + return() +endif() + +set(found_iface_h 0) +file(STRINGS "${vcProjectFile}" lines) +foreach(line IN LISTS lines) + if(line MATCHES "<([A-Za-z0-9_]+) +Include=.*iface\\.h") + set(rule "${CMAKE_MATCH_1}") + if(NOT rule STREQUAL "None") + set(RunCMake_TEST_FAILED "iface.h referenced as ${rule} instead of None in\n ${vcProjectFile}") + return() + endif() + if(found_iface_h) + set(RunCMake_TEST_FAILED "iface.h referenced multiple times in\n ${vcProjectFile}") + return() + endif() + set(found_iface_h 1) + endif() +endforeach() +if(NOT found_iface_h) + set(RunCMake_TEST_FAILED "iface.h not referenced in\n ${vcProjectFile}") +endif() diff --git a/Tests/RunCMake/VS10Project/InterfaceLibSources.cmake b/Tests/RunCMake/VS10Project/InterfaceLibSources.cmake new file mode 100644 index 0000000000..3672be18c0 --- /dev/null +++ b/Tests/RunCMake/VS10Project/InterfaceLibSources.cmake @@ -0,0 +1 @@ +add_library(iface INTERFACE iface.h) diff --git a/Tests/RunCMake/VS10Project/LanguageStandard-check.cmake b/Tests/RunCMake/VS10Project/LanguageStandard-check.cmake new file mode 100644 index 0000000000..85e28581b4 --- /dev/null +++ b/Tests/RunCMake/VS10Project/LanguageStandard-check.cmake @@ -0,0 +1,23 @@ +set(vcProjectFile "${RunCMake_TEST_BINARY_DIR}/foo.vcxproj") +if(NOT EXISTS "${vcProjectFile}") + set(RunCMake_TEST_FAILED "Project file ${vcProjectFile} does not exist.") + return() +endif() + +set(found_LanguageStandard_stdcpp17 0) +set(found_LanguageStandard_C_stdc11 0) +file(STRINGS "${vcProjectFile}" lines) +foreach(line IN LISTS lines) + if(line MATCHES "<LanguageStandard>stdcpp17</LanguageStandard>") + set(found_LanguageStandard_stdcpp17 1) + endif() + if(line MATCHES "<LanguageStandard_C>stdc11</LanguageStandard_C>") + set(found_LanguageStandard_C_stdc11 1) + endif() +endforeach() +if(NOT found_LanguageStandard_stdcpp17) + string(APPEND RunCMake_TEST_FAILED "LanguageStandard stdcpp17 not found in\n ${vcProjectFile}\n") +endif() +if(NOT found_LanguageStandard_C_stdc11) + string(APPEND RunCMake_TEST_FAILED "LanguageStandard_C stdc11 not found in\n ${vcProjectFile}\n") +endif() diff --git a/Tests/RunCMake/VS10Project/LanguageStandard.cmake b/Tests/RunCMake/VS10Project/LanguageStandard.cmake new file mode 100644 index 0000000000..f8b62e2e6e --- /dev/null +++ b/Tests/RunCMake/VS10Project/LanguageStandard.cmake @@ -0,0 +1,5 @@ +enable_language(C) +enable_language(CXX) + +add_library(foo empty.c empty.cxx) +target_compile_features(foo PRIVATE c_std_11 cxx_std_17) diff --git a/Tests/RunCMake/VS10Project/NoImpLib-check.cmake b/Tests/RunCMake/VS10Project/NoImpLib-check.cmake new file mode 100644 index 0000000000..50722b22e6 --- /dev/null +++ b/Tests/RunCMake/VS10Project/NoImpLib-check.cmake @@ -0,0 +1,23 @@ +set(vcProjectFile "${RunCMake_TEST_BINARY_DIR}/foo.vcxproj") +if(NOT EXISTS "${vcProjectFile}") + set(RunCMake_TEST_FAILED "Project file ${vcProjectFile} does not exist.") + return() +endif() + +set(found_ImportLibrary 0) +set(found_TargetExt_dll 0) +file(STRINGS "${vcProjectFile}" lines) +foreach(line IN LISTS lines) + if(line MATCHES "<ImportLibrary>") + set(found_ImportLibrary 1) + endif() + if(line MATCHES "<TargetExt[^\n]*\\.dll") + set(found_TargetExt_dll 1) + endif() +endforeach() +if(found_ImportLibrary) + string(APPEND RunCMake_TEST_FAILED "ImportLibrary incorrectly found in\n ${vcProjectFile}\n") +endif() +if(NOT found_TargetExt_dll) + string(APPEND RunCMake_TEST_FAILED "TargetExt not found in\n ${vcProjectFile}\n") +endif() diff --git a/Tests/RunCMake/VS10Project/NoImpLib.cmake b/Tests/RunCMake/VS10Project/NoImpLib.cmake new file mode 100644 index 0000000000..2c11eac60e --- /dev/null +++ b/Tests/RunCMake/VS10Project/NoImpLib.cmake @@ -0,0 +1,3 @@ +enable_language(C) +set(CMAKE_IMPORT_LIBRARY_SUFFIX "") +add_library(foo SHARED empty.c) diff --git a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake index 93ef60343b..133dacc17a 100644 --- a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake +++ b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake @@ -3,9 +3,15 @@ cmake_policy(SET CMP0057 NEW) include(RunCMake) cmake_policy(SET CMP0054 NEW) +if(CMAKE_C_COMPILER_ID STREQUAL "MSVC" AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 19.27) + run_cmake(LanguageStandard) +endif() + run_cmake(VsCsharpSourceGroup) run_cmake(VsCSharpCompilerOpts) run_cmake(ExplicitCMakeLists) +run_cmake(InterfaceLibSources) +run_cmake(NoImpLib) run_cmake(RuntimeLibrary) run_cmake(SourceGroupCMakeLists) run_cmake(SourceGroupTreeCMakeLists) diff --git a/Tests/RunCMake/VS10Project/VsPlatformToolset-check.cmake b/Tests/RunCMake/VS10Project/VsPlatformToolset-check.cmake index 416220b834..0d82d3feb4 100644 --- a/Tests/RunCMake/VS10Project/VsPlatformToolset-check.cmake +++ b/Tests/RunCMake/VS10Project/VsPlatformToolset-check.cmake @@ -31,6 +31,6 @@ if (NOT "${OVERRIDEN_TOOLSET}" STREQUAL "MyCustomToolset") endif() if ("${NORMAL_TOOLSET}" STREQUAL "MyCustomToolset") - set(RunCMake_TEST_FAILED "Main toolset was overriden (it shouldn't)") + set(RunCMake_TEST_FAILED "Main toolset was overridden (it shouldn't)") return() endif() diff --git a/Tests/RunCMake/VS10Project/iface.h b/Tests/RunCMake/VS10Project/iface.h new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/Tests/RunCMake/VS10Project/iface.h |