[CMake] Cannot add target-level dependencies to non-existent target
Stephen Kelly
steveire at gmail.com
Tue Jun 30 17:34:05 EDT 2015
Glenn Coombs wrote:
> 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})
>
Use target_sources after the target is created.
add_library(systemc ${sources} ${headers})
if (PRE_COMPILED_HEADERS_FOUND)
ADD_PRECOMPILED_HEADER(${header_pch} ${source_pch} pch_files systemc)
target_sources(systemc PRIVATE ${pch_files})
endif()
Thanks,
Steve.
More information about the CMake
mailing list