[CMake] Install command using Optional for Visual Studio 9 2008

Anders Eriksson anderserikss0n at hotmail.com
Thu Jul 9 04:44:44 EDT 2009


 

Hi,

 

I am using CMake 2.6-patch 0 on Windows XP and I am generating build files for "Visual Stuiod 9 2008".

I have quertions regaring the Install command:

 

1) Is there a way to create a build target euqal to the install/fast target that is available for the "Unix Makefiles"

generator which does not depend on all the other targets?

 

2) I am using the "Optional" argument when calling the Install command. However, in the case of shared libraries, the 

"Visual Stuiod 9 2008" install scripts exit when a file to install is not present. I have tested this using the "Unix Makefiles" 

generator and there it seems to work as expected. For example I have:

 

ADD_LIBRARY(my_target SHARED source1.cpp source2.cpp)

INSTALL(TARGETS my_target DESTINATION lib LIBRARY OPTIONAL)

 

This generates an install script. A part of this looks like:

 

IF(NOT CMAKE_INSTALL_COMPONENT OR "${CMAKE_INSTALL_COMPONENT}" MATCHES "^(Unspecified)$")
  IF("${CMAKE_INSTALL_CONFIG_NAME}" MATCHES "^([Dd][Ee][Bb][Uu][Gg])$")
    FILE(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/lib" TYPE STATIC_LIBRARY OPTIONAL FILES "path/my_target.lib")
  ENDIF("${CMAKE_INSTALL_CONFIG_NAME}" MATCHES "^([Dd][Ee][Bb][Uu][Gg])$")
ENDIF(NOT CMAKE_INSTALL_COMPONENT OR "${CMAKE_INSTALL_COMPONENT}" MATCHES "^(Unspecified)$")

 

IF(NOT CMAKE_INSTALL_COMPONENT OR "${CMAKE_INSTALL_COMPONENT}" MATCHES "^(Unspecified)$")
  IF("${CMAKE_INSTALL_CONFIG_NAME}" MATCHES "^([Dd][Ee][Bb][Uu][Gg])$")
    FILE(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/lib" TYPE SHARED_LIBRARY FILES "path/my_target.dll")
  ENDIF("${CMAKE_INSTALL_CONFIG_NAME}" MATCHES "^([Dd][Ee][Bb][Uu][Gg])$")
 ENDIF(NOT CMAKE_INSTALL_COMPONENT OR "${CMAKE_INSTALL_COMPONENT}" MATCHES "^(Unspecified)$")

 

When the dll has not been build the install script exits. As i see it the second FILE command for the dll file is the problem, 

it does not contain the OPTIONAL command and therefor makes the script exit. Is this correct or did I missunderstand 

something here? If this is the problem, is there a workaround?

 

Thanks

/Anders

_________________________________________________________________
Vårkänslor och pirr i magen? Hitta din drömpartner här!
http://dejting.se.msn.com/channel/index.aspx?trackingid=1002952
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090709/401f57cb/attachment-0001.htm>


More information about the CMake mailing list