OK, thanks. I still think that if there is a difference in behavior for Makefile generators between MAIN_DEPENDENCY and DEPENDENCY there is a bug in CMake. Perhaps there needs to be bug filed for that. Here's the documentation:
In makefile terms this creates a new target in the following form:: OUTPUT: MAIN_DEPENDENCY DEPENDS COMMAND For a makefile, there shouldn't be a difference between the dependency coming in on MAIN_DEPENDENCY or DEPENDENCY. CMake is doing something else with that property. 2. I'm curious why this causes a problem. It seems to me that dummy.cpp should be present by the time the add_custom_command is even run, so why would it care whether it was created by CMake or anything else? James On Thu, Apr 30, 2015 at 9:42 AM, Nils Gladitz <nilsglad...@gmail.com> wrote: > On 29.04.2015 09:11, Nils Gladitz wrote: > >> The policy will likely have to be removed or replaced. >> > > I reverted the MAIN_DEPENDENCY specific CMP0057 commits and replaced the > policy with an unrelated one that is part of my "if-IN_LIST" topic to fill > the gap. > > This leaves the original issues that prompted the creation of CMP0057 open > for now. > > Two related but distinct issues are triggered by the following test cases > with the Makefile generator: > > 1) The following causes the given custom command to be emitted for both > the foo and bar target which can lead to parallel build errors: > > cmake_minimum_required(VERSION 3.2) > > file(WRITE test.in) > file(WRITE dummy.cpp "int main() {}") > > add_custom_command( > OUTPUT test.out > COMMAND ${CMAKE_COMMAND} -E echo Hello World > MAIN_DEPENDENCY test.in > ) > > add_executable(foo dummy.cpp test.in) > add_executable(bar dummy.cpp test.in) > > 2) The following causes the compile step for the dummy.cpp source file to > fail in presence of the custom command: > > cmake_minimum_required(VERSION 3.2) > > file(WRITE dummy.cpp "int main() {}") > > add_custom_command( > OUTPUT test.out > COMMAND ${CMAKE_COMMAND} -E echo Hello World > MAIN_DEPENDENCY dummy.cpp > ) > > add_executable(foo dummy.cpp) > > Nils >
-- 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