[cmake-developers] [CMake 0014370]: add_custom_command() commands run from incorrect directory with Ninja generator

2013-08-21 Thread Mantis Bug Tracker

The following issue has been SUBMITTED. 
== 
http://public.kitware.com/Bug/view.php?id=14370 
== 
Reported By:Robert Knight
Assigned To:
== 
Project:CMake
Issue ID:   14370
Category:   CMake
Reproducibility:always
Severity:   minor
Priority:   normal
Status: new
== 
Date Submitted: 2013-08-21 13:04 EDT
Last Modified:  2013-08-21 13:04 EDT
== 
Summary:add_custom_command() commands run from incorrect
directory with Ninja generator
Description: 
In the following project, if using the Ninja generator on Windows the first
post-build command runs in the directory that Ninja is run from, not the
directory specified by WORKING_DIRECTORY.  The second post-build command runs in
the correct directory.

Both commands run in the correct directory when using the NMake Makefiles
generator.


project(ninja-generator-test)

set(TEST_DIR ${CMAKE_CURRENT_BINARY_DIR}/foo)
file(MAKE_DIRECTORY ${TEST_DIR})

add_executable(test test.cpp)

# this file is created in the directory
# that ninja is run from
add_custom_command(TARGET test
  POST_BUILD
  COMMAND "${CMAKE_COMMAND}" -E touch foo.txt
  WORKING_DIRECTORY ${TEST_DIR}
)

# this file is created in the correct directory
add_custom_command(TARGET test
  POST_BUILD
  COMMAND "${CMAKE_COMMAND}" -E touch foo2.txt
  WORKING_DIRECTORY ${TEST_DIR}
)


The generated Ninja output in build.ninja for the test target is:


#
# Link the executable test.exe

build test.exe: CXX_EXECUTABLE_LINKER CMakeFiles\test.dir\test.obj
  FLAGS = /DWIN32 /D_WINDOWS /W3 /GR /EHsc /D_DEBUG /MDd /Zi /Ob0 /Od /RTC1
  LINK_FLAGS = /machine:X86  /debug /INCREMENTAL /subsystem:console
  LINK_LIBRARIES = kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib
ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib
  POST_BUILD = cmd.exe /c cd C:\Users\Win7-VM\mendeley\misc\ninja-test\build\foo
&& "C:\Program Files (x86)\CMake 2.8\bin\cmake.exe" -E touch foo.txt && cd
C:\Users\Win7-VM\mendeley\misc\ninja-test\build\foo && "C:\Program Files
(x86)\CMake 2.8\bin\cmake.exe" -E touch foo2.txt
  PRE_LINK = cd .
  TARGET_IMPLIB = test.lib
  TARGET_PDB = test.pdb


Here the first post-build command uses 'cmd.exe /c cd' to switch to the target
dir which has no effect and the second uses plain 'cd' which does.

== 

Issue History 
Date ModifiedUsername   FieldChange   
== 
2013-08-21 13:04 Robert Knight  New Issue
==

--

Powered by www.kitware.com

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

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

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


Re: [cmake-developers] How submit CMake dashboard to a different CDash server?

2013-08-21 Thread Sean McBride
On Fri, 16 Aug 2013 11:42:36 -0400, David Cole said:

>Try writing a dashboard_hook_build function, and setting the 
>CTEST_DROP_* variables in there.
>
>The CTestConfig settings in the CMake source tree win unless you set 
>those variables in the ctest script *after* the configure step. (I 
>think... if I'm remembering correctly.)

That mostly worked, thanks.  My CMake build now gets submitted to my own 
dashboard.  But cmake_common also automatically builds KWSys too, and that's 
still showing up on the public dashboard... any idea why?

Cheers,

-- 

Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com 
Mac Software Developer  Montréal, Québec, Canada


--

Powered by www.kitware.com

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

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

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