View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0015366CMakeCMakepublic2015-01-22 19:092016-01-04 11:51
ReporterDaniel v. Gerpen 
Assigned ToBrad King 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
PlatformLinuxOSUbuntuOS Version14.04
Product VersionCMake 3.1 
Target VersionCMake 3.1.2Fixed in VersionCMake 3.1.2 
Summary0015366: set_source_files_properties OBJECT_DEPENDS broken after normalization
DescriptionWith cmake 2.8.9 (ubuntu repos) and cmake 3.0.2 (build locally)
the attached project can be build.

[ 50%] Generating ../bla/stuff.h
Scanning dependencies of target app
[100%] Building CXX object blubb/CMakeFiles/app.dir/__/bla/a.cpp.o
Linking CXX executable app
[100%] Built target app

With 3.1 and 3.1.1 it fails because a custom command is not run:

Scanning dependencies of target app
make[2]: *** No rule to make target `blubb/../bla/stuff.h', needed by `blubb/CMakeFiles/app.dir/__/bla/a.cpp.o'. Stop.
make[1]: *** [blubb/CMakeFiles/app.dir/all] Error 2
make: *** [all] Error 2

Steps To Reproducetar zxf object_depends.tar.gz
cd object_depends
cmake .
make
Additional Informationhttps://github.com/Kitware/CMake/commit/c4af46 [^] is the first commit
with this behavior, it introduced normalization of OUTPUT and
DEPENDS in add_custom_command.

From what I can see OBJECT_DEPENDS in set_source_file_properties
is not normalized.
TagsNo tags attached.
Attached Filesgz file icon object_depends.tar.gz [^] (712 bytes) 2015-01-22 19:09

 Relationships
related to 0015467closed add_custom_target ALL option regression 
related to 0015642closedBrad King Source file properties lost if case of drive letter changes 

  Notes
(0037791)
Brad King (manager)
2015-01-23 14:12

From the tarball I was able to narrow the example down to a case involving no relative paths, no subdirectories in the source tree, and that works for in-source and out-of-source builds:

cmake_minimum_required(VERSION 3.0)
project(Issue15366 C)

add_custom_command(
  OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/sub/../sub/main.h
  COMMAND ${CMAKE_COMMAND} -E copy
            ${CMAKE_CURRENT_SOURCE_DIR}/main.h.in
            ${CMAKE_CURRENT_BINARY_DIR}/sub/main.h
  DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/main.h.in
  )

set_property(SOURCE main.c PROPERTY OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/sub/../sub/main.h)

include_directories(${CMAKE_CURRENT_BINARY_DIR}/sub)
add_executable(main main.c)


It works in 3.0 and not in 3.1.
(0037792)
Brad King (manager)
2015-01-23 14:14

Bisects to commit v3.1.0-rc1~471^2:

 add_custom_command: Normalize OUTPUT and DEPENDS paths.
 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c4af46b4 [^]
(0037857)
Brad King (manager)
2015-01-29 09:24

This commit should fix it:

 Normalize OBJECT_DEPENDS paths to match custom commands
 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9259d778 [^]

It won't work for the original example you gave because that uses a relative path in OBJECT_DEPENDS, but the documentation says that full paths are required.
(0037922)
Brad King (manager)
2015-02-05 09:24

I merged this fix into the 'release' branch for 3.1.2.
(0040090)
Robert Maynard (manager)
2016-01-04 11:51

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

 Issue History
Date Modified Username Field Change
2015-01-22 19:09 Daniel v. Gerpen New Issue
2015-01-22 19:09 Daniel v. Gerpen File Added: object_depends.tar.gz
2015-01-23 14:12 Brad King Note Added: 0037791
2015-01-23 14:14 Brad King Note Added: 0037792
2015-01-29 09:24 Brad King Note Added: 0037857
2015-01-29 09:24 Brad King Assigned To => Brad King
2015-01-29 09:24 Brad King Status new => resolved
2015-01-29 09:24 Brad King Resolution open => fixed
2015-01-29 09:24 Brad King Fixed in Version => CMake 3.2
2015-01-29 09:24 Brad King Target Version => CMake 3.2
2015-02-05 09:24 Brad King Note Added: 0037922
2015-02-05 09:24 Brad King Fixed in Version CMake 3.2 => CMake 3.1.2
2015-02-05 09:24 Brad King Target Version CMake 3.2 => CMake 3.1.2
2015-03-23 13:01 Brad King Relationship added related to 0015467
2015-07-09 10:30 Brad King Relationship added related to 0015642
2016-01-04 11:51 Robert Maynard Note Added: 0040090
2016-01-04 11:51 Robert Maynard Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team