[CMake] overriding ${PROJECTNAME}_BINARY_DIR before call to project()
Thomas Wolf
thomas.wolf at vision.ee.ethz.ch
Wed Sep 28 11:35:05 EDT 2011
Hi there,
I have some serious trouble to get a makefile running, comprising of
MITK, VTK, ITK, CTK, Log4Qt, DCMTK, GDCM, etc...
Because most of the makefiles have some imperfections regarding being
built under windows and x64 with the project environment of Visual
Studio 2008, we use direct builds in the main makefile. This also helps
to see all source code of the involved projects. The project
requirements are also set in a way that we cannto use git or downloads,
so the technique called "superbuild" is not applicable here.
To get the involved projects to be built at the correct place, namely
all created binaries in the CMAKE_BINARY_DIR location of the main
makefile, i try to override e.g. CTK_BINARY_DIR before the inclusion of
the CTK makefile via add_subdirectory.
I have a hard time doing this, even with
SET(CTK_BINARY_DIR ${CMAKE_BINARY_DIR} CACHE INTERNAL "" FORCE PARENT_SCOPE)
the next call to project(CTK) overrides this and takes some other value.
This value corresponds to the layout of the source tree apparently, but
is of no use in this situation.
How can I influence the value of CTK_BINARY_DIR before the call to the
makefile?
i tried to use project(CTK) in the toplevel makefile one directory up,
but even then the values won't be taken.
so this situation in
mainmakefile:
project(CTK)
set(CTK_BINARY_DIR "some other place" CACHE INTERNAL "" FORCE PARENT_SCOPE )
add_subdirectory(CTK)
does not change a thing for CTK. Even when the CTK makefile (naturally)
sets project(CTK), cmake does not complain or state something about
double projects, but silently overwrites the CTK_BINARY_DIR with new
values! So it respects the second call to 'project()', which in my
opinion should be either
a) reported as an error
or
b) the first call to project(CTK) should have priority
Can someone help me?
Regards,
Thomas
More information about the CMake
mailing list