# # Check C# VS project for required elements. # set(csProjectFile "${RunCMake_TEST_BINARY_DIR}/foo.csproj") if(NOT EXISTS "${csProjectFile}") set(RunCMake_TEST_FAILED "Project file ${csProjectFile} does not exist.") return() endif() set(inDebug FALSE) set(inRelease FALSE) set(debugOK FALSE) set(releaseOK FALSE) file(STRINGS "${csProjectFile}" lines) foreach(line IN LISTS lines) #message(STATUS ${line}) if(line MATCHES "^ * *$") set(inRelease FALSE) set(inDebug FALSE) elseif(inDebug AND (line MATCHES "^ *.*MY_FOO_DEFINE.* *$") AND (line MATCHES "^ *.*DEFINE_ONLY_FOR_DEBUG.* *$") AND (line MATCHES "^ *.*MY_BAR_ASSIGNMENT=bar.* *$") AND (NOT (line MATCHES "^ *.*DEFINE_ONLY_FOR_RELEASE.* *$")) ) set(debugOK TRUE) elseif(inRelease AND (line MATCHES "^ *.*MY_FOO_DEFINE.* *$") AND (line MATCHES "^ *.*DEFINE_ONLY_FOR_RELEASE.* *$") AND (line MATCHES "^ *.*MY_BAR_ASSIGNMENT=bar.* *$") AND (NOT (line MATCHES "^ *.*DEFINE_ONLY_FOR_DEBUG.* *$")) ) set(releaseOK TRUE) endif() endforeach() function(print_csprojfile) file(STRINGS "${csProjectFile}" lines) foreach(line IN LISTS lines) message(STATUS ${line}) endforeach() endfunction() if(NOT debugOK) message(STATUS "Failed to set Debug configuration defines correctly.") set(RunCMake_TEST_FAILED "Failed to set Debug configuration defines correctly.") print_csprojfile() return() endif() if(NOT releaseOK) message(STATUS "Failed to set Release configuration defines correctly.") set(RunCMake_TEST_FAILED "Failed to set Release configuration defines correctly.") print_csprojfile() return() endif()