[CMake] Can CMAKE_BINARY_DIR be realiable used before PROJECT()

David Cole david.cole at kitware.com
Fri Mar 5 11:37:47 EST 2010


It would seem so...

CMakeLists.txt:
=============
MESSAGE("before PROJECT")
MESSAGE("CMAKE_SOURCE_DIR=${CMAKE_SOURCE_DIR}")
MESSAGE("CMAKE_BINARY_DIR=${CMAKE_BINARY_DIR}")

PROJECT(hey NONE)

MESSAGE("after PROJECT")
MESSAGE("CMAKE_SOURCE_DIR=${CMAKE_SOURCE_DIR}")
MESSAGE("CMAKE_BINARY_DIR=${CMAKE_BINARY_DIR}")


Running that file with CMake 2.6.4 yields something like:
before PROJECT

CMAKE_SOURCE_DIR=C:/Users/davidcole/Desktop/b

CMAKE_BINARY_DIR=C:/Users/davidcole/Desktop/b/b

after PROJECT

CMAKE_SOURCE_DIR=C:/Users/davidcole/Desktop/b

CMAKE_BINARY_DIR=C:/Users/davidcole/Desktop/b/b



Similarly with 2.8.1-rc3:
before PROJECT

CMAKE_SOURCE_DIR=C:/Users/davidcole/Desktop/b

CMAKE_BINARY_DIR=C:/Users/davidcole/Desktop/b/c

after PROJECT

CMAKE_SOURCE_DIR=C:/Users/davidcole/Desktop/b

CMAKE_BINARY_DIR=C:/Users/davidcole/Desktop/b/c





On Fri, Mar 5, 2010 at 6:11 AM, Marcel Loose <loose at astron.nl> wrote:

> Hi all,
>
> Can you rely on the value of CMAKE_BINARY_DIR (and CMAKE_SOURCE_DIR for
> that matter) before the PROJECT() statement has been seen by CMake?
>
> Best regards,
> Marcel Loose.
>
>
> _______________________________________________
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20100305/5cc5d30b/attachment.htm>


More information about the CMake mailing list