MantisBT - CMake
View Issue Details
0011319CMakeCMakepublic2010-10-15 19:192016-06-10 14:31
Ivan Shcheklein 
Bill Hoffman 
normalmajoralways
closedmoved 
CMake-2-8 
 
0011319: VS2010 generator failed to create rule file
The following code:

set(errdbg_GENERATED ${CMAKE_CURRENT_BINARY_DIR}/errdbg/generated.txt)

ADD_CUSTOM_COMMAND(
 OUTPUT ${errdbg_GENERATED}
 COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_SOURCE_DIR}/myfile.txt ${CMAKE_CURRENT_BINARY_DIR}/errdbg/generated.txt
 DEPENDS ${PROJECT_SOURCE_DIR}/myfile.txt)

 ADD_CUSTOM_TARGET(${PROJECT_NAME} DEPENDS ${errdbg_GENERATED})

fails to generate errdbg/generated.txt.rule. Which means that VS 2010 is building this project again and again.

The following command fixes this (before set):

execute_process(COMMAND mkdir ${CMAKE_CURRENT_BINARY_DIR}/errdbg)
No tags attached.
zip cmake.zip (1,771) 2010-10-15 19:19
https://public.kitware.com/Bug/file/3451/cmake.zip
zip cmake-new.zip (1,744) 2010-11-19 14:10
https://public.kitware.com/Bug/file/3516/cmake-new.zip
Issue History
2010-10-15 19:19Ivan ShchekleinNew Issue
2010-10-15 19:19Ivan ShchekleinFile Added: cmake.zip
2010-10-15 22:15Bill HoffmanNote Added: 0022506
2010-10-15 22:15Bill HoffmanStatusnew => assigned
2010-10-15 22:15Bill HoffmanAssigned To => Bill Hoffman
2010-10-16 07:10Ivan ShchekleinNote Added: 0022507
2010-10-21 12:10Ivan ShchekleinNote Added: 0022586
2010-11-19 14:10Ivan ShchekleinFile Added: cmake-new.zip
2010-11-19 14:12Ivan ShchekleinNote Added: 0023451
2011-03-08 13:44David ManuraNote Added: 0025695
2011-03-08 13:54David ManuraNote Edited: 0025695bug_revision_view_page.php?bugnote_id=25695#r237
2016-06-10 14:28Kitware RobotNote Added: 0041754
2016-06-10 14:28Kitware RobotStatusassigned => resolved
2016-06-10 14:28Kitware RobotResolutionopen => moved
2016-06-10 14:31Kitware RobotStatusresolved => closed

Notes
(0022506)
Bill Hoffman   
2010-10-15 22:15   
There is a fix for this already in next, please try a nightly CMake binary.
(0022507)
Ivan Shcheklein   
2010-10-16 07:10   
Do you mean cmake-2.8.2.20101015-gcde67-win32-x86.exe? I've tried it. It still fails to create the rule file if remove 'mkdir' command from the 'kernel/common/cmakelists.txt'.
(0022586)
Ivan Shcheklein   
2010-10-21 12:10   
Doesn't work on 2.8.3-rc3 either. I still get:

========== Build: 1 succeeded, 0 failed, 1 up-to-date, 0 skipped ==========

every time I start build.
(0023451)
Ivan Shcheklein   
2010-11-19 14:12   
Reattached the file (removed mkdir command to make it reproducible right from the package). Unfortunatelly, bug still reproducible with cmake 2.8.3.

Please, let me know if you failed to reproduce. We need this to be fixed since it stops our VS 2010 migration.
(0025695)
David Manura   
2011-03-08 13:44   
(edited on: 2011-03-08 13:54)
I'm seeing something like this too on CMake 2.8.4 / MSVC2010. Create the following CMakeLists.txt file:

#############
project(test NONE)
cmake_minimum_required(VERSION 2.8)

set(name ${CMAKE_CURRENT_BINARY_DIR}/a/b.txt)

add_custom_command(
  OUTPUT ${name}
  COMMAND ${CMAKE_COMMAND} -E touch ${name}
  COMMENT "running command"
)

add_custom_target(one ALL DEPENDS ${name})
##################


Then run "cmake ." once followed by "msbuild test.sln" multiple times. Each run displays "running command" even though the file "a\b.txt" is created on the first build. Creating an empty "a\b.txt.rule" file (which didn't exist) myself fixes it.

If, however, the "name" does not contain a subdirectory:

  set(name ${CMAKE_CURRENT_BINARY_DIR}/b.txt)

cmake *will* create b.txt.rule file, and the "running command" correctly displays only on the first build.

The problem does not occur, however, when targeting autotools.

(0041754)
Kitware Robot   
2016-06-10 14:28   
Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.