[CMake] how to map configurations from include_external_msproject() ?

Gerhard Pobinger gerhard.pobinger at gmx.at
Tue Feb 9 07:36:03 EST 2016


I'm trying to include legacy Visual Studio projects into a cmake generated
solution like this:

project(Crypto)

include_external_msproject(${PROJECT_NAME}_vcproj
   "${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}_vs90.vcproj"
)

# add_dependencies(${PROJECT_NAME}_vcproj
# )

add_library(${PROJECT_NAME} INTERFACE)

target_link_libraries(${PROJECT_NAME} INTERFACE
   debug ${LIB_PATH_DEBUG}/${PROJECT_NAME}.lib 
   optimized ${LIB_PATH_RELEASE}/${PROJECT_NAME}.lib
)

add_dependencies(${PROJECT_NAME}
   ${PROJECT_NAME}_vcproj
)

This works only as long as the vcproj-files contain a configuration named
'release' and 'debug', but when they don't it seems there is no way to map
the existing configuration names (as also requested in
https://cmake.org/pipermail/cmake/2010-April/036388.html). I tried the
proposed way with imported targets, but I didn't succeed.

How can I map a configuration of an external ms-project (e.g.
'release_shared') into a configuration (e.g. 'release') of the
cmake-generated solution? The problem is that simply adding a configuration
named 'release' works, of course, but then I'd have to change the external
vcproj...






More information about the CMake mailing list