[CMake] Fwd: Adding custom directories to PATH enviroment
Michael Wild
themiwi at gmail.com
Wed Apr 13 14:32:07 EDT 2011
On 04/13/2011 05:52 PM, Gabriele Greco wrote:
> Then you haven't read or understood my message ;-) Instead of calling
> idlcc directly in the add_custom_command, you call a wrapper script,
> that sets the PATH environment variable, and *then* invokes idlcc.
>
>
> Ok, I implemented your solution and it works, thanks!
Great!
>
> One additional comment: Creating output in the source tree is a *very*
> bad habit. Some people (including me) consider it to be obscene... ;-)
> Unless you are doing an in-source build (which you shouldn't, for the
> same reasons you shouldn't create output in the source tree), a build
> system should *never* modify the source tree.
>
>
> Yeah, you are right, I didn't like that too, I've changed the system to
> output the interfaces in ${PROJECT_BINARY_DIR}/inc/intf,
> the only thing I don't like is that to make this work, inside the
> "interface" CMakeLists.txt I've had to insert this:
>
> execute_process(
> COMMAND cp -r "${PROJECT_SOURCE_DIR}/inc/intf" "${PROJECT_BINARY_DIR}/inc/"
> )
That's clunky and not portable, see below for the commonly used solution.
>
> To copy the interface files that are actually hand written and then
> committed to the repository in the binary path.
>
> It works, but I suppose I should add a mechanism to copy one of these
> files again if the user changes it... And i fear the only way to do it
> is to add a list of all these files by hand to the interfaces
> CMakeLists.txt and make the copy process a custom target that depends
> from the file in the source tree
>
> --
> Bye,
> Gabry
You're right about the explicit listing, but you should do the copying
using configure_file(... COPYONLY). And don't even think about using
file(GLOB) and friends, that's usually the wrong approach.
Michael
More information about the CMake
mailing list