2012/5/9 Terrence Meiczinger <[email protected]>:
> I have a top level cmake toolchain file and I want it to include another 
> file. If I give the include a string filename it works. However, if I try to 
> make the filename a variable, it can no longer find the included file. It 
> appears cmake is stripping the path.
>
>
> The following works fine...
>
> linux-gnu-x86_64.cmake:
>
> include("/src/toolchains/linux-common.cmake")
>
> however, if I do the following it does not..
>
> linux-gnu-x86_64.cmake:
> set(TOOLCHAIN_COMMON "/src/toolchains/linux-common.cmake")
> message(STATUS "TOOLCHAIN_COMMON: ${TOOLCHAIN_COMMON}")
> include("${TOOLCHAIN_COMMON}")
>
>
> It fails:
>
> -> cmake -DCMAKE_TOOLCHAIN_FILE=/src/toolchains/linux-gnu-x86_64.cmake
>
> -- TOOLCHAIN_TOP:          /src/toolchains/linux-gnu-x86_64.cmake
> -- TOOLCHAIN_COMMON: /src/toolchains/linux-common.cmake
> -- The C compiler identification is GNU
> -- The CXX compiler identification is GNU
> -- Check for working C compiler: /usr/bin/gcc
> CMake Error at /src/toolchains/linux-gnu-x86_64.cmake:18 (INCLUDE):
>   include could not find load file:
>
>     /linux-common.cmake
>
> As you can see the from the status output, the path is the same as the first 
> example. However, it appears cmake is stripping it prior to actually 
> including it.
>
> Now, if I change the include as follows, it works... but this seems icky.
>
> include("${${TOOLCHAIN_COMMON}}")
>
> Any insight into why this behavior is occurring?

Woud you be able to reproduce this "include" error outside of a toolchain scope?
Could you try attached example.

put the two files somewhere and run:
cmake -P includeTest.cmake

by the way which version of CMake are you using?


-- 
Erk
Le gouvernement représentatif n'est pas la démocratie --
http://www.le-message.org

Attachment: include_me.cmake
Description: Binary data

Attachment: includeTest.cmake
Description: Binary data

--

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

Reply via email to