I make this very simple project in order to reproduce a possible bug:

cmake_minimum_required(VERSION 2.8)
project(HelloLib)
set(SOURCES
   ./sayHello.cpp
   ./fileToExclude.c
)
set_source_files_properties(
                           ./fileToExclude.c
   PROPERTIES HEADER_FILE_ONLY TRUE)

add_library(HelloLib STATIC ${SOURCES})

When I try to generate a VS2010 project, it produces an invalid XML. In particular it generates the following section:
<ItemGroup>
   <ClCompile Include="..\sayHello.cpp" />
   <ClInclude Include="..\fileToExclude.c">
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">CompileAsC</CompileAs> <CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">CompileAsC</CompileAs> <CompileAs Condition="'$(Configuration)|$(Platform)'=='MinSizeRel|Win32'">CompileAsC</CompileAs> <CompileAs Condition="'$(Configuration)|$(Platform)'=='RelWithDebInfo|Win32'">CompileAsC</CompileAs>
   </ClCompile>
 </ItemGroup>

It seems that CMake get confused when it has to merge the HEADER_FILE_ONLY property with some other informations like CompileAS etc.... In fact when I change the file extension from ./sayHello.cpp to ./sayHello.c everything works fine.
A similar problem happens when I try to specify additional includes:
set_source_files_properties(./fileToExclude.c PROPERTIES COMPILE_FLAGS "-IW:\\myPath")

The same CMakeLists.txt works fine for Eclipse and MinGW makefile as target.
I currently use the last version of CMake (2.8.3)

Let me know if it's an actual bug or if I make some mistakes.
_______________________________________________
Powered by www.kitware.com

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

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

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to