summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2011-01-04 20:44:01 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2011-01-04 20:44:01 (GMT)
commitf1d7a5600fab0d3cd314fd9ae059010ea6f7e5b9 (patch)
tree864eea994d526a99eb3c10c449968d50a292d2da
parentda9b5fe4b521bbb9d873cfa3ebc9c67c0d6b66bf (diff)
parent8c7b19d35ee81afac57fe623217578191f4d034c (diff)
downloadCMake-f1d7a5600fab0d3cd314fd9ae059010ea6f7e5b9.zip
CMake-f1d7a5600fab0d3cd314fd9ae059010ea6f7e5b9.tar.gz
CMake-f1d7a5600fab0d3cd314fd9ae059010ea6f7e5b9.tar.bz2
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.
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx5
-rw-r--r--Tests/CMakeLists.txt4
-rw-r--r--Tests/VSResource/CMakeLists.txt7
-rw-r--r--Tests/VSResource/main.cpp10
-rw-r--r--Tests/VSResource/test.rc5
-rw-r--r--Tests/VSResource/test.txt1
6 files changed, 30 insertions, 2 deletions
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 20ed5a8..ed017c7 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -1133,10 +1133,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);
}
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index 289e632..911b247 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -131,6 +131,9 @@ IF(BUILD_TESTING)
ADD_TEST_MACRO(TarTest TarTest)
ADD_TEST_MACRO(SystemInformation SystemInformation)
ADD_TEST_MACRO(MathTest MathTest)
+ IF(MSVC)
+ ADD_TEST_MACRO(VSResource VSResource)
+ ENDIF()
ADD_TEST_MACRO(Simple Simple)
ADD_TEST_MACRO(PreOrder PreOrder)
ADD_TEST_MACRO(MissingSourceFile MissingSourceFile)
@@ -246,7 +249,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}
diff --git a/Tests/VSResource/CMakeLists.txt b/Tests/VSResource/CMakeLists.txt
new file mode 100644
index 0000000..e842955
--- /dev/null
+++ b/Tests/VSResource/CMakeLists.txt
@@ -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)
diff --git a/Tests/VSResource/main.cpp b/Tests/VSResource/main.cpp
new file mode 100644
index 0000000..6f68df3
--- /dev/null
+++ b/Tests/VSResource/main.cpp
@@ -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;
+ }
+}
diff --git a/Tests/VSResource/test.rc b/Tests/VSResource/test.rc
new file mode 100644
index 0000000..8aab8b7
--- /dev/null
+++ b/Tests/VSResource/test.rc
@@ -0,0 +1,5 @@
+#ifdef CMAKE_RCDEFINE
+hello TEXT DISCARDABLE CMAKE_RCDEFINE
+#else
+#error "resource compiler did not get defines from command line!"
+#endif \ No newline at end of file
diff --git a/Tests/VSResource/test.txt b/Tests/VSResource/test.txt
new file mode 100644
index 0000000..980a0d5
--- /dev/null
+++ b/Tests/VSResource/test.txt
@@ -0,0 +1 @@
+Hello World!