[CMake] ADD_CUSTOM_COMMAND and how to include generated files
from other directories
blinkeye
gentoo at blinkeye.ch
Sun Feb 17 11:19:11 EST 2008
On 02/17/2008 04:51 PM, Mike Jackson wrote:
> Lets assume for a second that your layout is something like:
>
> Project
> src
> -sub1
> --CMakeLists.txt
> --sub1.cpp
> --sub1.ui
> -sub2
> --CMakeLists.txt
> --sub2.cpp
>
> What you would want quite possible is a top level CMakeLists.txt file
> Like this:
>
> PROJECT (MyGreatProject)
>
> SET (LIBRARY_OUTPUT_PATH "${PROJECT_BINARY_DIR}/Bin" CACHE INTERNAL
> "For libraries.")
> SET (EXECUTABLE_OUTPUT_PATH "${PROJECT_BINARY_DIR}/Bin" CACHE
> INTERNAL "For executables.")
>
> #--- All the generated .h and .cpp files end up in $
> {CMAKE_CURRENT_BINARY_DIR}
> #--- so include that directory.
> INCLUDE_DIRECTORIES( "${CMAKE_CURRENT_BINARY_DIR}" )
>
> ADD_SUBDIRECTORY( src/sub1)
> ADD_SUBDIRECTORY( src/sub2)
>
> #--- End CMakeLists.txt file
>
> The above _should_ work although I just did it from memory.
>
> Mike Jackson
>
Thanks for your replay. But no, this doesn't work. This goes along with
what Alex just wrote back - include_directory behaves like normal
variables. Setting
INCLUDE_DIRECTORIES( "${CMAKE_CURRENT_BINARY_DIR}" )
just works for the directory you're currently at and the directories
beneath it - but not for those above or on the same level.
More information about the CMake
mailing list