[CMake] Visual C++ and cpack
Michael Jackson
mike.jackson at bluequartz.net
Wed Jun 1 06:37:21 EDT 2011
If that really is your exact code from cmake you are building a
static library only. There must be another argument to the add_library
command that says SHARED. With out that argument cmake will always
generate a static library build.
Also Visual Studio will generate the "Release" subdirectory for you.
I do not think you can change that behavior.
Lastly you may want to consider naming the plugins with a .plugin
extension so the cpack rules know the difference between a shared
library and a tripe plugin base in file extension which tends to work
better in my experience.
Hope that helps
Mike Jackson
On Wednesday, June 1, 2011, Mathias Bavay <bavay at slf.ch> wrote:
> Hi!
>
> I've been using cmake and cpak on Linux for my project (a library) without any problems. I'm now trying to get it to work with Visual C++ Express 10. It compiles fine, and puts files (from the project directory) into meteoio/Release (both a .dll and a .lib). When running cpack, it only packs the .lib file, and I can not find any way to also properly get the dll.
>
> Here is a sample of my code for compiling the library:
> SET(LIBPREFIX "lib") #make sure ALL plugins are libXXX for ALL plateforms
> SET(CMAKE_IMPORT_LIBRARY_PREFIX "lib") #for Visual C++ import libraries
> SET(SHAREDNAME ${PROJECT_NAME})
> ADD_LIBRARY(${SHAREDNAME} ${meteoio_sources})
> TARGET_LINK_LIBRARIES(${SHAREDNAME} ${LIBPROJ})
> SET_TARGET_PROPERTIES(${SHAREDNAME} PROPERTIES
> PREFIX "${LIBPREFIX}"
> LIBRARY_OUTPUT_DIRECTORY lib
> ARCHIVE_OUTPUT_DIRECTORY lib
> CLEAN_DIRECT_OUTPUT 1
> VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}"
> SOVERSION "${VERSION_MAJOR}"
> )
> INSTALL(TARGETS ${SHAREDNAME}
> RUNTIME DESTINATION bin
> LIBRARY DESTINATION lib
> ARCHIVE DESTINATION lib
> COMPONENT libraries
> )
>
> First issue, despite specifying that I want the library to be under lib, it goes into a Release directory under the source file's directory. But when cpack should find and pack it, it only gets the .lib and always misses the dll:
> IF(WIN32) #handle the special case of WIN32 needing import libraries
> FILE(GLOB importlibs "lib/libmeteoio*.lib*")
> SET(DLL_EXT "dll")
> ENDIF(WIN32)
> FILE(GLOB solibs "lib/libmeteoio*.${DLL_EXT}*")
> FILE(GLOB alibs "lib/*.${STAT_EXT}*")
> INSTALL(FILES ${solibs} ${importlibs} ${alibs} DESTINATION lib COMPONENT libraries)
>
> What am I doing wrong? It works perfectly fine under Linux (obviously, only packing a .so), but not with Visual C++... The whole code can be seen at https://slfsmm.indefero.net/p/meteoio/source/tree/HEAD/
>
> Thank you very much,
> Mathias Bavay
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
>
--
_________________________________________________________
Mike Jackson mike.jackson at bluequartz.net
BlueQuartz Software www.bluequartz.net
Principal Software Engineer Dayton, Ohio
More information about the CMake
mailing list