Merge topic 'add_preprocessor_def_vs2010_resources'

8c7b19d Only run resource test for MSVC compilers.
753e208 Disable incremental testing for this test, it crashes vs9 linker.
16e7d4b Add flags to resource builds on vs 2010 with a test.
This commit is contained in:
Brad King 2011-01-04 15:44:01 -05:00 committed by CMake Topic Stage
commit f1d7a5600f
6 changed files with 30 additions and 2 deletions

View File

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

View File

@ -131,6 +131,9 @@ IF(BUILD_TESTING)
ADD_TEST_MACRO(TarTest TarTest) ADD_TEST_MACRO(TarTest TarTest)
ADD_TEST_MACRO(SystemInformation SystemInformation) ADD_TEST_MACRO(SystemInformation SystemInformation)
ADD_TEST_MACRO(MathTest MathTest) ADD_TEST_MACRO(MathTest MathTest)
IF(MSVC)
ADD_TEST_MACRO(VSResource VSResource)
ENDIF()
ADD_TEST_MACRO(Simple Simple) ADD_TEST_MACRO(Simple Simple)
ADD_TEST_MACRO(PreOrder PreOrder) ADD_TEST_MACRO(PreOrder PreOrder)
ADD_TEST_MACRO(MissingSourceFile MissingSourceFile) ADD_TEST_MACRO(MissingSourceFile MissingSourceFile)
@ -246,7 +249,6 @@ IF(BUILD_TESTING)
--test-command Simple) --test-command Simple)
LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Simple_CodeBlocksGenerator") LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Simple_CodeBlocksGenerator")
ENDIF ("${cmakeOutput}" MATCHES CodeBlocks) ENDIF ("${cmakeOutput}" MATCHES CodeBlocks)
# check for the KDevelop3 generator # check for the KDevelop3 generator
IF ("${cmakeOutput}" MATCHES KDevelop3) IF ("${cmakeOutput}" MATCHES KDevelop3)
ADD_TEST(Simple_KDevelop3Generator ${CMAKE_CTEST_COMMAND} ADD_TEST(Simple_KDevelop3Generator ${CMAKE_CTEST_COMMAND}

View File

@ -0,0 +1,7 @@
cmake_minimum_required (VERSION 2.6)
project (VSResource)
add_definitions(/DCMAKE_RCDEFINE="test.txt")
string(REPLACE "/INCREMENTAL:YES" ""
CMAKE_EXE_LINKER_FLAGS_DEBUG
"${CMAKE_EXE_LINKER_FLAGS_DEBUG}")
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!