View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0010086CMakeCMakepublic2009-12-30 00:582011-04-04 12:00
ReporterUli M 
Assigned ToBrad King 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionno change required 
PlatformOSOS Version
Product VersionCMake-2-8 
Target VersionFixed in Version 
Summary0010086: SET_SOURCE_FILES_PROPERTIES faulty with sub dirs (still)
DescriptionSee also bug 0002859 (I can't append notes to that so here's a new bug)

Source file properties are not saved accross subdirs (at least not COMPILE_FLAGS). If this is intentional I have no idea how you could build a single lib from multiple subdirs without putting all the set_..._prop together in one cmake file.I've been using one static lib per dir before but now I'm generating shared libraries and that doesn't seem to go well with static libs.
Additional InformationUsing cmake 2.8.0 you can reproduce it like this:

-- CMakeLists.txt

PROJECT(bla)

set_source_files_properties(
  ${CMAKE_SOURCE_DIR}/test.c PROPERTIES COMPILE_FLAGS "-DSOMETHING")
get_source_file_property(PROPS ${CMAKE_SOURCE_DIR}/test.c COMPILE_FLAGS)
message("${PROPS}")

add_subdirectory(sub)

-- sub/CMakeLists.txt

get_source_file_property(PROPS ${CMAKE_SOURCE_DIR}/test.c COMPILE_FLAGS)
message("${PROPS}")

The result being:

...
-- Detecting CXX compiler ABI info - done
-DSOMETHING
NOTFOUND
...
TagsNo tags attached.
Attached Files

 Relationships
related to 0002859closedBrad King SET_SOURCE_FILE_PROPERTIES faulty with sub dirs 

  Notes
(0023927)
Brad King (manager)
2010-12-13 13:16

http://www.cmake.org/cmake/help/cmake-2-8-docs.html#command:set_source_files_properties [^]
"Source file properties are visible only to targets added in the same directory"

http://www.cmake.org/cmake/help/cmake-2-8-docs.html#command:set_property [^]
"Note that source file properties are visible only to targets added in the same directory"

Yes, all the calls to set_source_file_properties need to occur in one directory, but that does not mean all the code has to be in one file. You can use include() to bring in a file from each subdirectory instead of using add_subdirectory().

BTW, I suggest using the COMPILE_DEFINITIONS property instead of -DFOO with COMPILE_FLAGS.
(0026037)
David Cole (manager)
2011-04-04 12:00

Closing resolved issues that have not been updated in more than 3 months.

 Issue History
Date Modified Username Field Change
2009-12-30 00:58 Uli M New Issue
2010-12-11 10:03 Kovarththanan Rajaratnam Relationship added related to 0002859
2010-12-13 13:05 Bill Hoffman Assigned To => Brad King
2010-12-13 13:05 Bill Hoffman Status new => assigned
2010-12-13 13:16 Brad King Note Added: 0023927
2010-12-13 13:17 Brad King Status assigned => resolved
2010-12-13 13:17 Brad King Resolution open => no change required
2011-04-04 12:00 David Cole Note Added: 0026037
2011-04-04 12:00 David Cole Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team