diff options
author | Brad King <brad.king@kitware.com> | 2018-04-13 13:49:51 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2018-04-13 13:49:51 (GMT) |
commit | d00306636b4fa1cefb469126734766b5996cbe93 (patch) | |
tree | 2cf5af9d3747ed451d1ab86ab8a26b38a72e25a6 /Tests | |
parent | 61607fffbbdb918b7a305c1c4597bb5175d046e8 (diff) | |
parent | 8480c2afc09d3e976e4eff69081f41d812fb35cb (diff) | |
download | CMake-d00306636b4fa1cefb469126734766b5996cbe93.zip CMake-d00306636b4fa1cefb469126734766b5996cbe93.tar.gz CMake-d00306636b4fa1cefb469126734766b5996cbe93.tar.bz2 |
Merge branch 'backport-fix-explicit-CMakeLists.txt' into release-3.11
Merge-request: !1959
Diffstat (limited to 'Tests')
6 files changed, 55 insertions, 0 deletions
diff --git a/Tests/RunCMake/VS10Project/ExplicitCMakeLists-check.cmake b/Tests/RunCMake/VS10Project/ExplicitCMakeLists-check.cmake new file mode 100644 index 0000000..b671e35 --- /dev/null +++ b/Tests/RunCMake/VS10Project/ExplicitCMakeLists-check.cmake @@ -0,0 +1,25 @@ +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(foundCMakeLists 0) +file(STRINGS "${vcProjectFile}" lines) +foreach(line IN LISTS lines) + if(line MATCHES "<([A-Za-z0-9_]+) +Include=.*CMakeLists.txt") + set(rule "${CMAKE_MATCH_1}") + if(NOT rule STREQUAL "CustomBuild") + set(RunCMake_TEST_FAILED "CMakeLists.txt referenced as ${rule} instead of CustomBuild") + return() + endif() + if(foundCMakeLists) + set(RunCMake_TEST_FAILED "CMakeLists.txt referenced multiple times") + return() + endif() + set(foundCMakeLists 1) + endif() +endforeach() +if(NOT foundCMakeLists) + set(RunCMake_TEST_FAILED "CMakeLists.txt not referenced") +endif() diff --git a/Tests/RunCMake/VS10Project/ExplicitCMakeLists.cmake b/Tests/RunCMake/VS10Project/ExplicitCMakeLists.cmake new file mode 100644 index 0000000..c9e4456 --- /dev/null +++ b/Tests/RunCMake/VS10Project/ExplicitCMakeLists.cmake @@ -0,0 +1,3 @@ +set(CMAKE_CONFIGURATION_TYPES Debug) +enable_language(CXX) +add_executable(foo foo.cpp ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt) diff --git a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake index 7100b31..a8d806f 100644 --- a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake +++ b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake @@ -1,4 +1,7 @@ include(RunCMake) + +run_cmake(ExplicitCMakeLists) + run_cmake(VsConfigurationType) run_cmake(VsTargetsFileReferences) run_cmake(VsCustomProps) diff --git a/Tests/RunCMake/XcodeProject/ExplicitCMakeLists-check.cmake b/Tests/RunCMake/XcodeProject/ExplicitCMakeLists-check.cmake new file mode 100644 index 0000000..3073e0b --- /dev/null +++ b/Tests/RunCMake/XcodeProject/ExplicitCMakeLists-check.cmake @@ -0,0 +1,20 @@ +set(xcProjectFile "${RunCMake_TEST_BINARY_DIR}/ExplicitCMakeLists.xcodeproj/project.pbxproj") +if(NOT EXISTS "${xcProjectFile}") + set(RunCMake_TEST_FAILED "Project file ${xcProjectFile} does not exist.") + return() +endif() + +set(foundCMakeLists 0) +file(STRINGS "${xcProjectFile}" lines) +foreach(line IN LISTS lines) + if(line MATCHES "PBXBuildFile.*fileRef.*CMakeLists.txt") + if(foundCMakeLists) + set(RunCMake_TEST_FAILED "CMakeLists.txt referenced multiple times") + return() + endif() + set(foundCMakeLists 1) + endif() +endforeach() +if(NOT foundCMakeLists) + set(RunCMake_TEST_FAILED "CMakeLists.txt not referenced") +endif() diff --git a/Tests/RunCMake/XcodeProject/ExplicitCMakeLists.cmake b/Tests/RunCMake/XcodeProject/ExplicitCMakeLists.cmake new file mode 100644 index 0000000..678b0ea --- /dev/null +++ b/Tests/RunCMake/XcodeProject/ExplicitCMakeLists.cmake @@ -0,0 +1,2 @@ +enable_language(CXX) +add_executable(foo foo.cpp ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt) diff --git a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake index 5eff6b9..1150666 100644 --- a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake +++ b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake @@ -4,6 +4,8 @@ if(XCODE_VERSION VERSION_GREATER_EQUAL 9) set(IOS_DEPLOYMENT_TARGET "-DCMAKE_XCODE_ATTRIBUTE_IPHONEOS_DEPLOYMENT_TARGET=10") endif() +run_cmake(ExplicitCMakeLists) + run_cmake(XcodeFileType) run_cmake(XcodeAttributeLocation) run_cmake(XcodeAttributeGenex) |