2 # Check C# VS project for required elements.
4 set(csProjectFile "${RunCMake_TEST_BINARY_DIR}/foo.csproj")
5 if(NOT EXISTS "${csProjectFile}")
6 set(RunCMake_TEST_FAILED "Project file ${csProjectFile} does not exist.")
17 file(STRINGS "${csProjectFile}" lines)
18 foreach(line IN LISTS lines)
19 #message(STATUS ${line})
20 if(line MATCHES "^ *<PropertyGroup .*Debug.*")
22 elseif(line MATCHES "^ *<PropertyGroup .*Release.*")
24 elseif(line MATCHES "^ *</PropertyGroup> *$")
28 (line MATCHES "^ *<DefineConstants>.*MY_FOO_DEFINE.*</DefineConstants> *$") AND
29 (line MATCHES "^ *<DefineConstants>.*DEFINE_ONLY_FOR_DEBUG.*</DefineConstants> *$") AND
30 (NOT (line MATCHES "^ *<DefineConstants>.*DEFINE_ONLY_FOR_RELEASE.*</DefineConstants> *$")) AND
31 (NOT (line MATCHES "^ *<DefineConstants>.*MY_BAR_ASSIGNMENT=bar.*</DefineConstants> *$"))
35 (line MATCHES "^ *<DefineConstants>.*MY_FOO_DEFINE.*</DefineConstants> *$") AND
36 (line MATCHES "^ *<DefineConstants>.*DEFINE_ONLY_FOR_RELEASE.*</DefineConstants> *$") AND
37 (NOT (line MATCHES "^ *<DefineConstants>.*DEFINE_ONLY_FOR_DEBUG.*</DefineConstants> *$")) AND
38 (NOT (line MATCHES "^ *<DefineConstants>.*MY_BAR_ASSIGNMENT=bar.*</DefineConstants> *$"))
44 function(print_csprojfile)
45 file(STRINGS "${csProjectFile}" lines)
46 foreach(line IN LISTS lines)
47 message(STATUS ${line})
53 message(STATUS "Failed to set Debug configuration defines correctly.")
54 set(RunCMake_TEST_FAILED "Failed to set Debug configuration defines correctly.")
60 message(STATUS "Failed to set Release configuration defines correctly.")
61 set(RunCMake_TEST_FAILED "Failed to set Release configuration defines correctly.")