[CMake] Strange install behavior

Alexander Zimmermann a1z at gmx.de
Tue Mar 17 13:28:03 EDT 2009


Hello,

I noticed a strange behavior of cmake during the installation phase with
Visual Studio 2008. To demonstrate what's happening I made this CMakeLists.txt:

- - -
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)

IF(MSVC)
  SET(CMAKE_INSTALL_PREFIX c:/Temp/cmake_test)
  SET(FOO_DEF foo.def)
ELSE(MSVC)
  SET(CMAKE_INSTALL_PREFIX /tmp/cmake_test)
  SET(FOO_DEF)
ENDIF(MSVC)

ADD_LIBRARY(foo_static STATIC foo.c)
ADD_LIBRARY(foo_shared SHARED foo.c ${FOO_DEF})

SET_TARGET_PROPERTIES(foo_static PROPERTIES 
  RELEASE_OUTPUT_NAME libfoo_static_release
  DEBUG_OUTPUT_NAME libfoo_static_debug
  MINSIZEREL_OUTPUT_NAME libfoo_static_minsizerel
  RELWITHDEBINFO_OUTPUT_NAME libfoo_static_relwithdebinfo)

SET_TARGET_PROPERTIES(foo_shared PROPERTIES 
  SOVERSION 1 VERSION 1.0.0
  RELEASE_OUTPUT_NAME libfoo_shared_release
  DEBUG_OUTPUT_NAME libfoo_shared_debug
  MINSIZEREL_OUTPUT_NAME libfoo_shared_minsizerel
  RELWITHDEBINFO_OUTPUT_NAME libfoo_shared_relwithdebinfo)


INSTALL(TARGETS foo_static foo_shared
  LIBRARY DESTINATION release/lib
  RUNTIME DESTINATION release/bin
  ARCHIVE DESTINATION release/arch
  CONFIGURATIONS Release)

INSTALL(TARGETS foo_static foo_shared
  LIBRARY DESTINATION debug/lib
  RUNTIME DESTINATION debug/bin
  ARCHIVE DESTINATION debug/arch
  CONFIGURATIONS Debug)

INSTALL(TARGETS foo_static foo_shared
  LIBRARY DESTINATION minsizerel/lib
  RUNTIME DESTINATION minsizerel/bin
  ARCHIVE DESTINATION minsizerel/arch
  CONFIGURATIONS MinSizeRel)

INSTALL(TARGETS foo_static foo_shared
  LIBRARY DESTINATION relwithdebinfo/lib
  RUNTIME DESTINATION relwithdebinfo/bin
  ARCHIVE DESTINATION relwithdebinfo/arch
  CONFIGURATIONS RelWithDebInfo)
- - -

When calling the INSTALL target this happens:

-- Install configuration: "Debug"
-- Installing: c:/Temp/cmake_test/release/bin/libfoo_shared_debug.dll
-- Up-to-date: c:/Temp/cmake_test/debug/arch/libfoo_static_debug.lib
-- Installing: c:/Temp/cmake_test/debug/arch/libfoo_shared_debug.lib
-- Installing: c:/Temp/cmake_test/debug/bin/libfoo_shared_debug.dll
-- Installing: c:/Temp/cmake_test/minsizerel/bin/libfoo_shared_debug.dll
-- Installing: c:/Temp/cmake_test/relwithdebinfo/bin/libfoo_shared_debug.dll

-- Install configuration: "Release"
-- Up-to-date: c:/Temp/cmake_test/release/arch/libfoo_static_release.lib
-- Up-to-date: c:/Temp/cmake_test/release/arch/libfoo_shared_release.lib
-- Up-to-date: c:/Temp/cmake_test/release/bin/libfoo_shared_release.dll
-- Up-to-date: c:/Temp/cmake_test/debug/bin/libfoo_shared_release.dll
-- Up-to-date: c:/Temp/cmake_test/minsizerel/bin/libfoo_shared_release.dll
-- Up-to-date: c:/Temp/cmake_test/relwithdebinfo/bin/libfoo_shared_release.dll


Why does an install configuration "Debug" install the dll-file in ALL
target paths?

Am I doing something wrong?
Or is this a (known) bug in cmake?

Any help wellcome.

Alexander




More information about the CMake mailing list