[cmake-developers] [CMake 0013263]: SOURCES target property (get_property()) has very inconsistent result - wildly differing path specifications

Mantis Bug Tracker mantis at public.kitware.com
Fri Jun 1 08:41:04 EDT 2012


The following issue has been SUBMITTED. 
====================================================================== 
http://www.itk.org/Bug/view.php?id=13263 
====================================================================== 
Reported By:                Andreas Mohr
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   13263
Category:                   CMake
Reproducibility:            always
Severity:                   major
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2012-06-01 08:41 EDT
Last Modified:              2012-06-01 08:41 EDT
====================================================================== 
Summary:                    SOURCES target property (get_property()) has very
inconsistent result - wildly differing path specifications
Description: 
The appended sample yields the following output:

[amoh at lxamoh build]$ cmake ..
tgt_sources
main.cpp;[TEST_ROOT]/get_property_sources_broken_paths/test.rc;blubb.tas
-- Configuring done
CMake Error at CMakeLists.txt:17 (add_library):
  Cannot find source file:

    blubb.tas

  Tried extensions .c .C .c++ .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm .hpp
  .hxx .in .txx


-- Build files have been written to:
[TEST_ROOT]/get_property_sources_broken_paths/build


Note the very inconsistent items in the tgt_sources line shown above:
For (I assume) all language-related files a project-*relative* path will be
preserved, whereas for *existing* foreign-language files the *absolute* path to
the project-contained file (due to the result returned by the existence check?)
will be delivered, plus for *non-existing* foreign-language files the *relative*
path will be returned.

Whoa.

Since AFAIK it is recommended practice to add all files within a project to the
target (well, at least *.c* and *.h*, maybe NOT *.rc* and other more foreign
files?), this inconsistency is an annoying PROBLEM if detected, and a very
annoying BUG if undetected.

Thanks!

Steps to Reproduce: 
cmake_minimum_required(VERSION 2.6)

project(get_property_sources_broken_paths)

file(WRITE main.cpp "
int main()
{
  #include \"get_property_sources_broken_paths.h\"

  return 0;
}
")

file(WRITE test.rc "")

#add_executable(get_property_sources_broken_paths main.cpp test.rc blubb.tas)
add_library(get_property_sources_broken_paths SHARED main.cpp test.rc blubb.tas)

get_property(tgt_sources TARGET get_property_sources_broken_paths PROPERTY
SOURCES)

message("tgt_sources ${tgt_sources}")

====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2012-06-01 08:41 Andreas Mohr   New Issue                                    
======================================================================




More information about the cmake-developers mailing list