[CMake] CMake Visual Studio Configuration Single

Jörg Kreuzberger j.kreuzberger at procitec.de
Tue Jul 1 03:38:58 EDT 2014


> I'm not sure why you would recommend anything related to 
> CMAKE_BUILD_TYPE for the Visual Studio generators. I would be curious 
> to know exactly how you are using it, because internally, 
> CMAKE_BUILD_TYPE (to the best of my knowledge) is completely ignored by 
> the Visual Studio generators.

I had three issues with it, two seems solved with cmake 3.0
My project is organised in a form like 
root
 - common / libs / ..
 - programs / ..


1) Installation of files 
 In the installation ( install TARGET ...) i had to install some shared libraries from the common/libs targets
 with cmake 2.8.12 i was not able to use <TARGET_FILE:target>, so i solved with with properties, which always must consider if or not they are build with single or multi configuration
  e.g.
   if( WIN32 )
    if( MINGW)
      set_property( ...   ${CMAKE_CURRENT_BINARY_DIR}/x.dll)
    else()
      set_property( ...   ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/x.dll)
   else if( UNIX )

i think this is solved with cmake 3.0, i can use the <TARGET_FILE:target> directly in install calls

2) use programs/libs from build for running tests
In CMake 2.8 i was not able to use the <TARGET_PATH:target> notation in calls to set_test_properties() so i had to differ here the files paths too. This is solved with cmake 3.0

3) using imported location
my project is used for developer and customer build (customer gets sourcecode). But he does not get all source code, some of the libaries he only gets binary.
To use same cmake files in programs/, i use the set_target_properties( .. IMPORTED_LOCATION ...). Depending on how we build it (mingw, devstudio etc), i differ between the paths like above. No other solution found here... find_package, find_programs and so on is here no alternative, cause i want to use the TARGETS.

4) installation
i have one installation target. install( TARGET ... LOCATION ..) if i build debug, this contains debug, if i build release, this contains release. So it gets mixed and i have to differ location...


So i think 2 out of 4 issues are solved with cmake 3.0

As newbee to cmake i only could not understand why this single / multi configuration stuff is supported. it makes it more complicated, but i assume it is like always: historical grown.

I personally would totaly accept seperated vs solutions for debug and release in different build directories, only relying on CMAKE_BUILD_TYPE at cmake configuration time, with output in same directory structure (without debug/release) like e.g. with nmake.

Mannheim HRB 504702
Geschäftsführer: Dipl.-Ing. (FH) Michael Brenk (Vorsitzender), Dipl.-Ing. (FH) Dipl.-Inf. (FH) Jens Heyen

This e-mail may contain confidential and/or legally protected information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and delete this e-mail. Any unauthorized copying, disclosure or distribution of the material in this email is strictly forbidden.
Thank you!




More information about the CMake mailing list