Add flags to resource builds on vs 2010 with a test.

This commit is contained in:
Bill Hoffman 2010-12-21 09:17:21 -05:00
parent 4c88a8622d
commit 16e7d4ba2c
6 changed files with 35 additions and 2 deletions

View File

@ -1139,10 +1139,13 @@ OutputIncludes(std::vector<std::string> const & includes)
void cmVisualStudio10TargetGenerator::
WriteRCOptions(std::string const& ,
WriteRCOptions(std::string const& configName,
std::vector<std::string> const & includes)
{
this->WriteString("<ResourceCompile>\n", 2);
Options& clOptions = *(this->ClOptions[configName]);
clOptions.OutputPreprocessorDefinitions(*this->BuildFileStream, " ",
"\n");
this->OutputIncludes(includes);
this->WriteString("</ResourceCompile>\n", 2);
}

View File

@ -246,7 +246,6 @@ IF(BUILD_TESTING)
--test-command Simple)
LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Simple_CodeBlocksGenerator")
ENDIF ("${cmakeOutput}" MATCHES CodeBlocks)
# check for the KDevelop3 generator
IF ("${cmakeOutput}" MATCHES KDevelop3)
ADD_TEST(Simple_KDevelop3Generator ${CMAKE_CTEST_COMMAND}
@ -262,6 +261,17 @@ IF(BUILD_TESTING)
ENDIF ("${cmakeOutput}" MATCHES KDevelop3)
ENDIF(${CMAKE_TEST_GENERATOR} MATCHES "Unix Makefiles" OR ${CMAKE_TEST_GENERATOR} MATCHES "KDevelop")
ADD_TEST(VSResource ${CMAKE_CTEST_COMMAND}
--build-and-test
"${CMake_SOURCE_DIR}/Tests/VSResource"
"${CMake_BINARY_DIR}/Tests/VSResource"
--build-two-config
--build-generator ${CMAKE_TEST_GENERATOR}
--build-project VSResource
--build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
--test-command VSResource)
LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/VSResource")
# test for correct sub-project generation
# not implemented in VS6 or Xcode

View File

@ -0,0 +1,4 @@
cmake_minimum_required (VERSION 2.6)
project (VSResource)
add_definitions(/DCMAKE_RCDEFINE="test.txt")
add_executable(VSResource main.cpp test.rc)

10
Tests/VSResource/main.cpp Normal file
View File

@ -0,0 +1,10 @@
#include <windows.h>
int main(int argc, char** argv) {
HRSRC hello = ::FindResource(0, "hello", "TEXT");
if(hello) {
return 0;
} else {
return 1;
}
}

5
Tests/VSResource/test.rc Normal file
View File

@ -0,0 +1,5 @@
#ifdef CMAKE_RCDEFINE
hello TEXT DISCARDABLE CMAKE_RCDEFINE
#else
#error "resource compiler did not get defines from command line!"
#endif

View File

@ -0,0 +1 @@
Hello World!