diff options
Diffstat (limited to 'Tests/RunCMake/VS10Project')
9 files changed, 131 insertions, 1 deletions
diff --git a/Tests/RunCMake/VS10Project/CSharpSourceGroup/foo.cs b/Tests/RunCMake/VS10Project/CSharpSourceGroup/foo.cs new file mode 100644 index 0000000..3695dc9 --- /dev/null +++ b/Tests/RunCMake/VS10Project/CSharpSourceGroup/foo.cs @@ -0,0 +1,3 @@ +void foo() +{ +} diff --git a/Tests/RunCMake/VS10Project/CSharpSourceGroup/images/empty.bmp b/Tests/RunCMake/VS10Project/CSharpSourceGroup/images/empty.bmp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/VS10Project/CSharpSourceGroup/images/empty.bmp diff --git a/Tests/RunCMake/VS10Project/CSharpSourceGroup/nested/baz.cs b/Tests/RunCMake/VS10Project/CSharpSourceGroup/nested/baz.cs new file mode 100644 index 0000000..d5d334a --- /dev/null +++ b/Tests/RunCMake/VS10Project/CSharpSourceGroup/nested/baz.cs @@ -0,0 +1,3 @@ +void baz() +{ +} diff --git a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake index 8a04f78..3ca7cc0 100644 --- a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake +++ b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake @@ -3,12 +3,12 @@ cmake_policy(SET CMP0057 NEW) include(RunCMake) cmake_policy(SET CMP0054 NEW) +run_cmake(VsCsharpSourceGroup) run_cmake(VsCSharpCompilerOpts) run_cmake(ExplicitCMakeLists) run_cmake(RuntimeLibrary) run_cmake(SourceGroupCMakeLists) run_cmake(SourceGroupTreeCMakeLists) - run_cmake(VsConfigurationType) run_cmake(VsTargetsFileReferences) run_cmake(VsCustomProps) @@ -30,6 +30,7 @@ run_cmake(VsDpiAware) run_cmake(VsDpiAwareBadParam) run_cmake(VsPrecompileHeaders) run_cmake(VsPrecompileHeadersReuseFromCompilePDBName) +run_cmake(VsDeployEnabled) run_cmake(VsWinRTByDefault) diff --git a/Tests/RunCMake/VS10Project/VsCsharpSourceGroup-check.cmake b/Tests/RunCMake/VS10Project/VsCsharpSourceGroup-check.cmake new file mode 100644 index 0000000..3b5c70f --- /dev/null +++ b/Tests/RunCMake/VS10Project/VsCsharpSourceGroup-check.cmake @@ -0,0 +1,22 @@ +set(csProjFile "${RunCMake_TEST_BINARY_DIR}/VsCsharpSourceGroup.csproj") +if(NOT EXISTS "${csProjFile}") + set(RunCMake_TEST_FAILED "Project file ${csProjFile} does not exist.") + return() +endif() + +file(STRINGS "${csProjFile}" lines) + +include(${RunCMake_TEST_SOURCE_DIR}/VsCsharpSourceGroupHelpers.cmake) + +set(SOURCE_GROUPS_TO_FIND + "CSharpSourceGroup" + "CSharpSourceGroup/nested" + "Images" +) + +foreach(GROUP_NAME IN LISTS ${SOURCE_GROUPS_TO_FIND}) + find_source_group("${lines}" ${GROUP_NAME}) + if(NOT ${SOURCE_GROUP_FOUND}) + return() + endif() +endforeach() diff --git a/Tests/RunCMake/VS10Project/VsCsharpSourceGroup.cmake b/Tests/RunCMake/VS10Project/VsCsharpSourceGroup.cmake new file mode 100644 index 0000000..024993c --- /dev/null +++ b/Tests/RunCMake/VS10Project/VsCsharpSourceGroup.cmake @@ -0,0 +1,16 @@ +enable_language(CSharp) +set(CMAKE_CONFIGURATION_TYPES Debug) + +set(SRC_FILES + ${CMAKE_CURRENT_SOURCE_DIR}/CSharpSourceGroup/foo.cs + ${CMAKE_CURRENT_SOURCE_DIR}/CSharpSourceGroup/nested/baz.cs +) + +set(IMAGE_FILES + ${CMAKE_CURRENT_SOURCE_DIR}/CSharpSourceGroup/Images/empty.bmp +) + +add_library(VsCsharpSourceGroup SHARED ${SRC_FILES} ${IMAGE_FILES}) +source_group("CSharpSourceGroup" FILES ${CMAKE_CURRENT_SOURCE_DIR}/CSharpSourceGroup/foo.cs) +source_group("CSharpSourceGroup/nested" FILES ${CMAKE_CURRENT_SOURCE_DIR}/CSharpSourceGroup/nested/baz.cs) +source_group("Images" FILES ${IMAGE_FILES}) diff --git a/Tests/RunCMake/VS10Project/VsCsharpSourceGroupHelpers.cmake b/Tests/RunCMake/VS10Project/VsCsharpSourceGroupHelpers.cmake new file mode 100644 index 0000000..bfa9a67 --- /dev/null +++ b/Tests/RunCMake/VS10Project/VsCsharpSourceGroupHelpers.cmake @@ -0,0 +1,15 @@ +function(find_source_group LINES NAME) + set(foundSourceGroupLink 0) + foreach(line IN LISTS LINES) + if(line MATCHES "<Link>${NAME}</Link>") + set(foundSourceGroupLink 1) + endif() + endforeach() + + if(NOT foundSourceGroupLink) + set(RunCMake_TEST_FAILED "Source group link for ${NAME} not found." PARENT_SCOPE) + set(SOURCE_GROUP_FOUND 0 PARENT_SCOPE) + return() + endif() + set(SOURCE_GROUP_FOUND 1 PARENT_SCOPE) +endfunction() diff --git a/Tests/RunCMake/VS10Project/VsDeployEnabled-check.cmake b/Tests/RunCMake/VS10Project/VsDeployEnabled-check.cmake new file mode 100644 index 0000000..0ff8678 --- /dev/null +++ b/Tests/RunCMake/VS10Project/VsDeployEnabled-check.cmake @@ -0,0 +1,58 @@ +set(vcProjectFile "${RunCMake_TEST_BINARY_DIR}/foo.vcxproj") +if(NOT EXISTS "${vcProjectFile}") + set(RunCMake_TEST_FAILED "Project file ${vcProjectFile} does not exist.") + return() +endif() +# +# Test solution file for deployment. +# + +set(vcSlnFile "${RunCMake_TEST_BINARY_DIR}/VsDeployEnabled.sln") +if(NOT EXISTS "${vcSlnFile}") + set(RunCMake_TEST_FAILED "Solution file ${vcSlnFile} does not exist.") + return() +endif() + + + +set(FooProjGUID "") +set(FoundFooProj FALSE) +set(InFooProj FALSE) +set(FoundReleaseDeploy FALSE) +set(DeployConfigs Debug MinSizeRel RelWithDebInfo ) + +file(STRINGS "${vcSlnFile}" lines) +foreach(line IN LISTS lines) +#message(STATUS "${line}") + if( (NOT InFooProj ) AND (line MATCHES "^[ \\t]*Project\\(\"{[A-F0-9-]+}\"\\) = \"foo\", \"foo.vcxproj\", \"({[A-F0-9-]+})\"[ \\t]*$")) + # First, identify the GUID for the foo project, and record it. + set(FoundFooProj TRUE) + set(InFooProj TRUE) + set(FooProjGUID ${CMAKE_MATCH_1}) + elseif(InFooProj AND line MATCHES "EndProject") + set(InFooProj FALSE) + elseif((NOT InFooProj) AND line MATCHES "${FooProjGUID}\\.Release.*\\.Deploy\\.0") + # If foo's Release configuration is set to deploy, this is the error. + set(FoundReleaseDeploy TRUE) + endif() + if( line MATCHES "{[A-F0-9-]+}\\.([^\\|]+).*\\.Deploy\\.0" ) + # Check that the other configurations ARE set to deploy. + list( REMOVE_ITEM DeployConfigs ${CMAKE_MATCH_1}) + endif() +endforeach() + +if(FoundReleaseDeploy) + set(RunCMake_TEST_FAILED "Release deployment enabled.") + return() +endif() + +if(NOT FoundFooProj) + set(RunCMake_TEST_FAILED "Failed to find foo project in the solution.") + return() +endif() + +list(LENGTH DeployConfigs length) +if( length GREATER 0 ) + set(RunCMake_TEST_FAILED "Failed to find Deploy lines for non-Release configurations. (${length})") + return() +endif() diff --git a/Tests/RunCMake/VS10Project/VsDeployEnabled.cmake b/Tests/RunCMake/VS10Project/VsDeployEnabled.cmake new file mode 100644 index 0000000..02b42b2 --- /dev/null +++ b/Tests/RunCMake/VS10Project/VsDeployEnabled.cmake @@ -0,0 +1,12 @@ +enable_language(CXX) + +set(DEPLOY_DIR + "temp\\foodir" +) + +add_library(foo SHARED foo.cpp) + +set_target_properties(foo + PROPERTIES + VS_SOLUTION_DEPLOY $<NOT:$<CONFIG:Release>> +) |