[CMake] Forcing location of binary directory in CMake

Michael Jackson mike.jackson at bluequartz.net
Thu Mar 26 15:36:14 EDT 2009


I would use something like the following:

get_filename_component(buildParent ${CMAKE_CURRENT_BINARY_DIR} PATH)
if (NOT ${buildParent} STREQUAL ${${PROJECT_NAME}_SOURCE_DIR})
	message(FATAL_ERROR "Wrong Build Directory")
endif()

Or something similar to that might work.

_________________________________________________________
Mike Jackson                  mike.jackson at bluequartz.net
BlueQuartz Software                    www.bluequartz.net
Principal Software Engineer                  Dayton, Ohio



On Mar 26, 2009, at 3:16 PM, Robert Dailey wrote:

> Hi,
>
> For various reasons I will not bother to mention here, I need to  
> stipulate the location of the binary directory. For example, if my  
> source directory is:
>
> C:\foo\bar
>
> My build directory *must* be here:
>
> C:\foo\bar\build
>
> The user should not have a choice in the matter. This is a  
> requirement. Is there a way to enforce this?
> _______________________________________________
> 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



More information about the CMake mailing list