On Sun, Feb 3, 2013 at 2:12 PM, Olaf Peter <[email protected]> wrote:
> Hi Sébastien,
>
>
>> > ---8<---
>> > project(coolcoding)
>> >
>> > # generate coolcoding's static lexer
>> > set(COOLCODING_BAR_HPP
>> ${PROJECT_BINARY_DIR}/include/foo/io/coolcoding/coolcoding_bar.hpp)
>> >
>> > add_executable(generate_coolcoding_bar generate_coolcoding_bar.cpp)
>> >
>> > add_custom_command(
>> > OUTPUT ${COOLCODING_BAR_HPP}
>> > COMMAND generate_coolcoding_bar ${COOLCODING_BAR_HPP}
>> > )
>>
>> You might want to add
>>
>> DEPENDS generate_coolcoding_bar
>>
>> to this command.
>>
>
> IMO the DEPENDS is only useful if you have an input file dependency, which
> isn't here the case.
Not only.
The line I suggested adds a dependency on the generator itself: if you
change the generator source file, it will get rebuilt, and thanks to
this DEPENDS rule, cmake will generate the files again.
> file(MAKE_DIRECTORY ${directory})
>
> did help, but is verbose since I use set(DIR ...) and set(HPP ${DIR}/...).
> It would be nice if cmake would know that there is a directory to create....
I know no better way than creating a small wrapper function to do
that, or letting you generator create the directory itself.
Cheers,
--
Powered by www.kitware.com
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Please keep messages on-topic and check the CMake FAQ at:
http://www.cmake.org/Wiki/CMake_FAQ
Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake