[Cmake] Combining Separate CMake Projects
Brad King
brad.king at kitware.com
Mon Jun 28 16:23:40 EDT 2004
Chris Scharver wrote:
> On Jun 28, 2004, at 10:41 AM, Brad King wrote:
>
>>> I did try this approach, and it worked perfectly. There is one extra
>>> directory layer, so maybe I should finally add a CUSTOM_COMMAND to
>>> install the resulting executable into the original source directory.
>>> That way, the end user doesn't have to care about how many directory
>>> layers are in place during the build as long as the executable is in
>>> the correct location relative to the data files. CUSTOM_COMMAND is
>>> still the only way to perform a target install for Visual Studio
>>> workspaces, correct?
>>
>>
>> There are a couple of choices. You can set LIBRARY_OUTPUT_PATH and
>> EXECUTABLE_OUTPUT_PATH to point at somewhere in the build tree (like
>> foo-build/bin) and then all executables and libraries will be placed
>> there as part of the normal build process. Also, CMake 2.0 has
>> support for install targets in windows.
>
>
> For now, I want to avoid copying all the data files to a new location.
> It's a lot easier for now to just place the binaries at the appropriate
> place in the source tree. I'm happy to see that INSTALL_TARGETS works on
> Windows now! I am encountering a strange issue with CMAKE_INSTALL_PREFIX
> now. In my top-level CMakeLists.txt, I have:
>
> MARK_AS_ADVANCED(CLEAR CMAKE_INSTALL_PREFIX)
> SET(CMAKE_INSTALL_PREFIX ${project_SOURCE_DIR})
>
> When I start the CMake GUI (2.0-2), this variable appears as /usr/local.
> However, when I build the install project in Visual Studio, the targets
> are installed into the correct directory! The CMakeCache.txt still
> contains /usr/local, and if I uncomment the lines above, the targets are
> installed into C:/usr/local. Something doesn't seem to match between the
> GUI and the interpreted value during the install. Is there some way that
> I can set the CMAKE_INSTALL_PREFIX in CMakeLists.txt and have the GUI
> reflect the updated value?
The SET command you are using just sets the variable for the CMake
configure phase. The cache file is used only to initialize these
values. To set it in the cache you need to call the SET command in a
special way. See the cmake documentation for the proper form of the
command:
http://www.cmake.org/HTML/Documentation.html
-Brad
More information about the Cmake
mailing list