[CMake] Cannot add target-level dependencies to non-existent target

Glenn Coombs glenn.coombs at gmail.com
Tue Jun 30 09:16:04 EDT 2015


I am getting the error in the subject.  The code I have looks like this:

    if (PRE_COMPILED_HEADERS_FOUND)
        ADD_PRECOMPILED_HEADER(${header_pch} ${source_pch} sources systemc)
    endif()

    add_library(systemc ${sources} ${sources_no_pch} ${headers})

where the call to add_dependency is in the ADD_PRECOMPILED_HEADER macro and
is adding a dependency on the systemc target about to be created on the
next line.  I could split the macro into 2 and call one before the
add_library and one after the add_library but that is rather messy.

At the point I try to add the dependency the target does not exist, but it
is added shortly after.  Is this the way CMake is supposed to behave or
should it only cause an error if the target doesn't exist at generate time
?

--
Glenn
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20150630/3da2e54c/attachment.html>


More information about the CMake mailing list