Hi,

I'm struggling with the following requirement:
I have a lib stored in a zip file (the lib is not built via cmake, e.g. 
delivered from external company).

I want a target to link against this lib and want to extract the lib from the 
zip file only if
this specific target is being built, and only if it is not already unzipped.

What I tried in the libs directory:

set(TARGET xxx)

add_library(${TARGET} STATIC IMPORTED GLOBAL)

set_target_properties(${TARGET} PROPERTIES IMPORTED_LOCATION
                      ${CMAKE_CURRENT_BINARY_DIR}/xxx.a)

set(ZIPFILE xxx.zip)

add_custom_target(${TARGET}_lib
                  COMMAND unzip -o ${CMAKE_CURRENT_SOURCE_DIR}/${ZIPFILE}
                  DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${ZIPFILE}
                  )
add_dependencies(${TARGET} ${TARGET}_lib)


Then I can use this target in e.g.
target_link_libraries(myTarget xxx)

The above however unzips the lib every time, even if it is already existing.
Is it possible to avoid that ?

P.S:This is the simple example. I have other similar problems when the zip file 
not only
holds 1 library but also a bunch of headerfiles and more than 1 lib ...

-- 
Best regards/Schöne Grüße

Martin

A: Because it breaks the logical sequence of discussion
Q: Why is top posting bad?

()  ascii ribbon campaign - against html e-mail 
/\  www.asciiribbon.org   - against proprietary attachments

This mail was not scanned before sending.
It was sent from a secure Linux desktop.
--

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

Reply via email to