On 09/22/2011 09:21 PM, Hauke Heibel wrote: > Hi Michael, > > First, thank you for the feedback. > > On Thu, Sep 22, 2011 at 7:19 PM, Michael Hertling <mhertl...@online.de> wrote: >> AFAICS, you've a single imported target GTest, and you are continuously >> setting *this* target's location - sometimes for a debug configuration, >> sometimes without configuration - to the location of its *prerequisite* >> libraries reported by the GTest package's find module or config file. > > If I am not totally wrong, in this case I am only setting the GTest > libraries and no additional *prerequisite*. The variable > GTEST_LIBRARIES only contains full qualified paths to gtest.lib and > gtestd.lib. > >> IMO, this doesn't make any sense. Possibly, you want to set the GTest >> target's IMPORTED_LINK_INTERFACE_LIBRARIES[_<CONFIG>] properties in >> place of the IMPORTED_LOCATION[_<CONFIG>] ones. > > Maybe I am wrong, but I just tried to copy what is done in the > FindQt4.cmake file or in other words to manually define what the > export() directive generates. I recognized an issue since I forgot to > define the property IMPORTED_CONFIGURATIONS. If I did not > misunderstand things completely, you were right if GTEST_LIBRARIES > would contain non GTest libs (the prerequisites). > >> What do you actually intent to achieve? Introduce a GTest imported >> target and set up its prerequisites reported in GTEST_LIBRARIES as >> it would be done for imported targets from the first? > > I think that's pretty much what I want to do. Create the import target > as if GTest were compiled with an export() directive. > >> Doesn't the >> GTEST_LIBRARIES variable per se work for you? > > To be honest, in this case it does. Maybe the example was bad. I think > I really need it for shared library targets, such as e.g. OpenCL. > > I want to prepare my libraries such that in the future a CMake based > installation also collects and installs DLLs of interface libraries. I > am further assuming that if I define a target of mine and link it > against an imported (let's say) OpenCL target with properly specified > IMPORTED_LOCATION (the DLL for shared libs), install() will copy it > for me.
No, it won't: CMAKE_MINIMUM_REQUIRED(VERSION 2.8 FATAL_ERROR) PROJECT(IMPORTTARGET C) SET(CMAKE_VERBOSE_MAKEFILE ON) FILE(WRITE ${CMAKE_BINARY_DIR}/main.c "int main(void){return 0;}\n") ADD_EXECUTABLE(main main.c) FIND_LIBRARY(M_LIBRARY m PATHS /usr/lib NO_DEFAULT_PATH) ADD_LIBRARY(m SHARED IMPORTED) SET_TARGET_PROPERTIES(m PROPERTIES IMPORTED_LOCATION ${M_LIBRARY}) TARGET_LINK_LIBRARIES(main m) INSTALL(TARGETS main RUNTIME DESTINATION bin) As you'll see after "cmake -DCMAKE_INSTALL_PREFIX=/dev/shm/usr ...", e.g., a "make install" will install the main executable but not the prerequisite libm.so library. Imported targets are meant to inform the project about targets already built - and possibly installed - by other projects; they don't suit to resolve a project's external dependencies during the installation. If you need this, you should definitely have a look at the BundleUtilities. > Maybe that's long shot - I need to read more about the actual > installation process and how it deals with dependencies. > > Regards, > Hauke Regards, Michael -- 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