The following issue has been SUBMITTED. 
====================================================================== 
http://public.kitware.com/Bug/view.php?id=15748 
====================================================================== 
Reported By:                James Johnston
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   15748
Category:                   CMake
Reproducibility:            always
Severity:                   major
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2015-09-16 18:20 EDT
Last Modified:              2015-09-16 18:20 EDT
====================================================================== 
Summary:                    Regression:  get_target_property dies if a source
file does not exist
Description: 
Previously, in CMake 3.3, one could call get_target_property to retrieve the
deprecated LOCATION target property even if not all source files exist yet. 
Now, in CMake master branch (commit febeabbf0b221a19bd4bf16ba7620af22d8dba17)
this does not work under some conditions.  The bug is a little tricky to isolate
into a test case - e.g. not all calls to get_target_property will die. (e.g. if
you call get_target_property from the same dir that creates the target, it seems
to work).  I am also not sure if the LOCATION property is the only target
property affected by this.

Even though LOCATION is deprecated, this matters because very recent OpenCV
versions still use it (e.g. in OpenCV/cmake/OpenCVGenPkgconfig.cmake).

Steps to Reproduce: 
1.  Create file CMakeLists.txt with this contents:

cmake_minimum_required(VERSION 2.6.3)
project(SourceTest)
add_subdirectory(subdir)
# Critical: this needs to happen in root CMakeLists.txt and not inside
# the subdir.
get_target_property(mypath Hello LOCATION_${CMAKE_BUILD_TYPE})
# Now we create the file later, so you can see, ultimately no error should
# happen e.g. during generate phase:
configure_file(subdir/Hello.c.in ${CMAKE_CURRENT_BINARY_DIR}/subdir/Hello.c)

2.  Create subdir/CMakeLists.txt with this contents:

add_executable(Hello ${CMAKE_CURRENT_BINARY_DIR}/Hello.c)

3.  The contents of subdir/Hello.c can be a simple Hello World program.
(actually the contents do not matter to repro this bug since you don't get to
compile phase...).

4.  Configure the project:

cmake -GNinja ../SourceTest

5.  I get this error:

CMake Error at subdir/CMakeLists.txt:1 (add_executable):
  Cannot find source file:

    C:/Users/JamesJ/Documents/Repositories/OI3D-2/SourceTest-build/subdir/Hello.
c

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


-- Configuring incomplete, errors occurred!
====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2015-09-16 18:20 James Johnston New Issue                                    
======================================================================

-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers

Reply via email to