[CMake] Install command using Optional for Visual Studio 9 2008
Anders Eriksson
anderserikss0n at hotmail.com
Wed Jul 29 08:03:54 EDT 2009
I posted this question a few weeks ago but didn't get any replies. I've notice that most questions get answered
so I'll post it again. If it's badly written please give some feedback. Thanks /Anders
Hi,
I am using CMake 2.6-patch 0 on Windows XP and I am generating build files for "Visual Studio 9 2008".
I have some questions regarding the Install command:
1) Is there a way to create a build target equal 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 Studio 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 therefore makes the script exit. Is this correct or did I misunderstand
something here? If this is the problem, is there a workaround?
Thanks
/Anders
Dela foton på ett smidigt sätt med Windows LiveT Photos. Dra och släpp
_________________________________________________________________
Med Windows Live kan du ordna, redigera och dela med dig av dina foton.
http://www.microsoft.com/sverige/windows/windowslive/products/photo-gallery-edit.aspx
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090729/d9378441/attachment.htm>
More information about the CMake
mailing list