[CMake] Default source properties and get_property plus LANGUAGE source propery has no effect.
Orcun Gokbulut
madorcun at gmail.com
Fri Mar 4 07:56:14 EST 2011
Hi everybody,
I came across two problems when I was porting our project build system to
cmake.
The first program that I encounter is I can not compile generated source
files with extension other than default c/c++ extensions.
I have tried;
set_property (SOURCE ZEPortalMap.h.zpp PROPERTY LANGUAGE CXX)
and this
SET (CMAKE_CXX_SOURCE_FILE_EXTENSIONS ${CMAKE_CXX_SOURCE_FILE_EXTENSIONS}
zpp)
but they do not work. File's build tool property in visual studio is still
custom build tool instead of c++ compiler.
While I was investigating the problem I came across another problem; I can
not read default values of a source property. In more generic terms value of
a source file property (I don't known whether this applies to
target/directory/global properties) is not defined unless it is defined by a
set command. However, those properties has build in default values that are
also overwritten by set functions. So there is no way of getting default
values of these properties.
The statements,
get_property (Result SOURCE ZEPortalMap.h PROPERTY COMPILE_FLAGS)
message (${Result})
returns this error message
CMake Error at Source/ZEMap/ZEPortalMap/CMakeLists.txt:23 (message):
message called with incorrect number of arguments
However if I do this;
set_property (SOURCE ZEPortalMap.h PROPERTY COMPILE_FLAGS "-blabla")
get_property (Result SOURCE ZEPortalMap.h PROPERTY COMPILE_FLAGS)
message (${Result})
I get:
-blabla
on the output. In sort, cmake does not setup default properties for source
files. (maybe for targets, directories, etc. I did not tested)
This causes (or can cause) problems for generic build system macros. Generic
macros can not depend on reading current value of a source/target/directory
properties because that property may not be instantiated by set function.
Of course I know that this problem can be functionality by design.
Best regards,
Orçun
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20110304/bd87a28f/attachment.htm>
More information about the CMake
mailing list