[cmake-developers] cmake --help-policy CMP0057 MAIN_DEPENDENCY
James Bigler
jamesbigler at gmail.com
Tue May 12 01:23:01 EDT 2015
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 <nilsgladitz at 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20150511/01e70957/attachment.html>
More information about the cmake-developers
mailing list