Package: cmake
Version: 2.6.4-3
Severity: important

The recent cmake update appears to have broken source file properties.  Here is
how to reproduce it minimally:

### 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 ###

Other 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().

-- System Information:
Debian Release: squeeze/sid
  APT prefers testing
  APT policy: (990, 'testing'), (300, 'unstable')
Architecture: i386 (i686)

Kernel: Linux 2.6.30-2-686 (SMP w/1 CPU core)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages cmake depends on:
ii  cmake-data             2.6.4-3           CMake data files (modules, templat
ii  libc6                  2.9-25            GNU C Library: Shared libraries
ii  libcurl3-gnutls        7.19.5-1.1        Multi-protocol file transfer libra
ii  libexpat1              2.0.1-4           XML parsing C library - runtime li
ii  libgcc1                1:4.4.1-4         GCC support library
ii  libstdc++6             4.4.1-4           The GNU Standard C++ Library v3
ii  libxmlrpc-c3           1.06.27-1         A lightweight RPC library based on
ii  zlib1g                 1:1.2.3.3.dfsg-15 compression library - runtime

cmake recommends no packages.

cmake suggests no packages.

-- no debconf information



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to