[CMake] Generate *.cpp/*.hpp with add_custom_command, reference these in add_library in another subdirectory/CMakeLists?

Nils Gladitz nilsgladitz at gmail.com
Mon Jan 13 04:11:07 EST 2014


On 01/13/2014 09:55 AM, Martin Zenzes wrote:
>
> One little quick follow-on-question. After doing:
>     set(GENERATED_CPP /path/to/not/yet/created/cpp/file.cpp)
> this does not work as expected:
>     set_property(SOURCE ${GENERATED_CPP} PROPERTY GENERATED)
> while this will works as expected:
>     set_source_files_properties(${GENERATED_CPP} PROPERTIES GENERATED)
>
> bug?
>

I think neither should work since you are missing a property value but
either
     set_property(SOURCE ${GENERATED_CPP} PROPERTY GENERATED ON)
or
     set_source_files_properties(${GENERATED_CPP} PROPERTIES GENERATED ON)
should work.

Nils


More information about the CMake mailing list