[CMake] External MS Project and setting active configuration

Magnus Therning magnus at therning.org
Mon Nov 11 09:13:14 EST 2013


Hi,

I'm trying to work out how to use include_external_msproject()
properly.  What I have so far isn't quite correct without a bit of
manual configuration in VS after generating the solution+project
files, which isn't quite the way I want it, of course.

What I'm struggling with is connecting the msproject with an imported
lib.  I currently have:

include_external_msproject(msproj
${CMAKE_CURRENT_SOURCE_DIR}/msproj/mymsproj.vcxproj)
add_library(mslib STATIC IMPORTED)
set_property(TARGET mslib
    PROPERTY MAP_IMPORTED_CONFIG_Debug LibDebug
    PROPERTY IMPORTED_LOCATION_Debug ${CMAKE_BINARY_DIR}/LibDebug/mymsproj.lib
    )

Hopefully it's obvious what I'm trying to achieve here, i.e.

  - I have a VS project in msproj/mymsproj.vcxproj (it gets included
properly, and it builds as it should)
  - The VS project defines a number of configurations,
Debug/Release/etc, but at the moment I'm only interested in the
LibDebug configuration and I want the CMake-config Debug to map to the
VS-project-config LibDebug
  - For the VS-project-config LibDebug the build output does end up in
the location mentioned

On running CMake all projects end up in the VS-project-config Debug
(which is default for CMake), but I did expect the above to put
mymsproj in the VS-project-config LibDebug.  What am I doing wrong
here?

/M

-- 
Magnus Therning                      OpenPGP: 0xAB4DFBA4
email: magnus at therning.org   jabber: magnus at therning.org
twitter: magthe               http://therning.org/magnus


More information about the CMake mailing list