2010/11/17 Thomas Lehmann <[email protected]>
>
> Hi all,
>
>
>
> for an automatically forced include I have provided an
>
> option like this:
>
>
>
> set(WIN32_SPEC ${CMAKE_CURRENT_SOURCE_DIR}/../../libs/global/win32_spec.h)

May you could use an absolute reference using

${PROJECT_SOURCE_DIR}/libs/global/win32_spec.h

if your project is name TOTO
(from the PROJECT(TOTO CXX) statement)
you use

${TOTO_SOURCE_DIR}/libs/global/win32_spec.h.

>
> add_definitions(-FI ${WIN32_SPEC})
>
>
> But when including this central file (find_package) the variable 
> CMAKE_CURRENT_SOURCE_DIR
> changes and then the path and filename of the header is wrong.
>
>
>
> How to proceed best?
> Can I avoid that for those “set” statement the variable is not overwritten by 
> those
> files including this central makefile?

You may use a CACHED variable
set(WIN32_SPEC ${PROJECT_SOURCE_DIR}/libs/global/win32_spec.h CACHE
FILEPATH "Central Include")

the first calling this will set the value then other set will be ignored.
If you want to override a CACHE var value you'll have to use FORCE set option.



--
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org
_______________________________________________
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