View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0009711CMakeCMakepublic2009-10-14 04:372009-10-16 13:28
ReporterModestas Vainius 
Assigned To 
PrioritynormalSeveritymajorReproducibilityalways
StatusclosedResolutionunable to reproduce 
Platformamd64OSDebian GNU/LinuxOS Versionsid
Product VersionCMake-2-6 
Target VersionFixed in Version 
Summary0009711: Source files properties don't propagate across subdirectories
DescriptionRelayed from http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=550908 [^] The bug applies to both 2.6.4 and 2.8.0-rc3 versions.

The recent cmake update appears to have broken source file properties.
Steps To Reproduce### begin ###
# rm -rf bindir srcdir
mkdir -p srcdir/subdir
mkdir bindir
cat <<EOF > srcdir/CMakeLists.txt
cmake_minimum_required(VERSION 2.6)
project(dummy)

set(file "\${CMAKE_BINARY_DIR}/output.cpp")

set_source_files_properties("\${file}" PROPERTIES SOME_USER_DEFINED_PROP blah)

get_source_file_property(val \${file} SOME_USER_DEFINED_PROP)

# Will print "blah", as expected
message(STATUS "\${val}")

add_subdirectory("subdir")
EOF

cat <<EOF > srcdir/subdir/CMakeLists.txt
get_source_file_property(val \${file} SOME_USER_DEFINED_PROP)
# Will print "NOTFOUND" instead of "blah", indicating the property was never
# defined.
message(STATUS "\${val}")
EOF

cd bindir
cmake ../srcdir
### end ###
Additional InformationOther forms of properties (eg target properties) are inherited as expected.

The bug is still present when:

- using different property setting functions like set_property().
- having the source file as an OUTPUT of an add_custom_command().
- calling define_property() before setting the property.
- locating the file in the srcdir instead of bindir.
- using a non-user defined property like GENERATED.

I did not test properties defined by cmake other than GENERATED (set by
add_custom_command()) because I'm not sure exactly when they are defined by the
system. I did test that add_custom_command() correctly sets the property in the
local scope; it just isn't inherited.

Apart from the obvious compatibility issues, this is a particularly problematic
bug because cmake will fail to configure if it cannot find a file existing in
the file system unless the file has the property GENERATED defined to a true
value. This property is automatically set by add_custom_command() which means
you can generate some file and then add_executable() with it.

Since only a subset of people will be affected by this bug I have not marked it
grave, but it does mean that anyone who meta-generates anything (eg. unit tests,
flex, bison, etc) can't use this version of cmake without hacks. Consequently
it might cause Debian package builds to fail in odd ways.

The workaround is to be aware in advance of what sources will be generated and
set the property to true in the directory where you add_executable().
TagsNo tags attached.
Attached Files

 Relationships

  Notes
(0018069)
Modestas Vainius (reporter)
2009-10-14 15:58

This bug might be invalid according to original reporter. I relayed it without too much investigation (my fault). Close it immediately if it is invalid.

 Issue History
Date Modified Username Field Change
2009-10-14 04:37 Modestas Vainius New Issue
2009-10-14 15:58 Modestas Vainius Note Added: 0018069
2009-10-16 13:28 Bill Hoffman Status new => closed
2009-10-16 13:28 Bill Hoffman Resolution open => unable to reproduce


Copyright © 2000 - 2018 MantisBT Team