not sure if there is a better way to resolve this issue:
declaring .RC files as header-only break ninja builds on non-windows
platforms.

--->8---

cmake currently tries to initialize the language rules for all source
files. when HEADER_FILE_ONLY is used to mark files which should be added
to the generated project, but should not be compiled, this will
nevertheless try to initialize the language, which might fail on that
specific platform. this is a practical issue when declaring .RC files as
header-only on non-windows platforms.
From 5a49f37edf8d038dc759d46084d1c4be19b6a486 Mon Sep 17 00:00:00 2001
From: Tim Blechmann <t...@klingt.org>
Date: Wed, 8 Apr 2015 13:36:21 +0200
Subject: [PATCH] ninja generator: don't initialize language for files marked
 as header-only

cmake currently tries to initialize the language rules for all source files.
when HEADER_FILE_ONLY is used to mark files which should be added to the
generated project, but should not be compiled, this will nevertheless try
to initialize the language, which might fail on that specific platform.
this is a practical issue when declaring .RC files as header-only on
non-windows platforms.
---
 Source/cmNinjaNormalTargetGenerator.cxx | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/Source/cmNinjaNormalTargetGenerator.cxx 
b/Source/cmNinjaNormalTargetGenerator.cxx
index c352c1a..b5c0985 100644
--- a/Source/cmNinjaNormalTargetGenerator.cxx
+++ b/Source/cmNinjaNormalTargetGenerator.cxx
@@ -119,6 +119,9 @@ void cmNinjaNormalTargetGenerator::WriteLanguagesRules()
   for(std::vector<cmSourceFile*>::const_iterator
         i = sourceFiles.begin(); i != sourceFiles.end(); ++i)
     {
+    if((*i)->GetPropertyAsBool("HEADER_FILE_ONLY"))
+      continue;
+
     const std::string& lang = (*i)->GetLanguage();
     if(!lang.empty())
       {
-- 
2.3.5

-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers

Reply via email to