[CMake] Using multiple config names in a single project

Timenkov Yuri ytimenkov at gmail.com
Thu Oct 2 02:25:50 EDT 2008


I don't think it is correct.
Better, you should pass configuration which you want to install to cpack.
For your solution, I suppose you need more elaborate build process. While VS
can do this job for you, on Unix you should (manually) explicitly build all
of your configurations. That is: (this usually should be done with script of
course)
1) create build directory for every your configuration:
build-debug, build-release, etc.
2) configure and build your project in each directory.
3) Tell cpack to install from every build directory. That is you should
explicitly write your cpack configuration file (which CPack.cmake usually
does for you), which installs from different build trees. You can tune your
CPackConfig.cmake (the generated default one), look how your project
installed. Usually it is something like this:

SET(CPACK_INSTALL_CMAKE_PROJECTS "/home/andy/vtk/CMake-bin;CMake;ALL;/")

You should write more quadruplets for each your configuration (look at
http://www.cmake.org/cmake/help/cmake2.6docs.html for more information).
And I looked at your CMakeLists.txt: you shouldn't use SET(CMAKE_BUILD_TYPE
"Release") in each directory. It is better to play with
configuration-specific names (see DEBUG_POSTFIX and *OUTPUT_NAME target
properties in link above).*

On Wed, Oct 1, 2008 at 10:53 PM, Karl Wallner <list at weps.de> wrote:

> Hi,
>
> I'm using cmake in a project to build different configurations
> (debug-static, debug-shared, release-...) of a library out of the same
> sources. All these
> built libraries have to be in a single project as cpack is used to make
> binary packages for windows and linux.
>
> In case of the windows platform everything works fine, under linux the
> generated binaries are not installed and packed.
>
> For the test case is attached (for cmake 2.6.x):
> $ tar xfz debug-and-release.tar.gz
> $ mkdir BUILD
> $ cd BUILD
> $ cmake ../debug-and-release
> ..
> $ make
> ..
> $ make install
> [ 33%] Built target bin1
> [ 66%] Built target bin2
> [100%] Built target bin3
> Install the project...
> -- Install configuration: ""
> -- Installing: /tmp/bin/bin1
>
> Only on of the 3 executables is installed.
>
> If hacked cmake-2.6.2 to do the job as wished. This patch is not perfect:
> It would be favourable to make this change configurable.
>
> -- Karl Wallner
>
>
> _______________________________________________
> CMake mailing list
> CMake at cmake.org
> http://www.cmake.org/mailman/listinfo/cmake
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20081002/b3f3a482/attachment.htm>


More information about the CMake mailing list