[...]
> I remember I had to do something with this in subversion. Let me dig down > a little bit... > In the current scenario the problem seems to be due to incorrect installation of targets in cmake. Currently, the install is called with custom bin and lib directories. However, apr modules are declared as MODULE libraries [1] in cmake. The thing is the artifacts this kind of targets work in a way so when install is called, the LIBRARY artifacts actually include DLL files of the targets. See [2] and the fragment below: [[[ ## Library Output Artifacts A library output artifact of a buildsystem target may be: - The loadable module file (e.g. .dll or .so) of a module library target created by the add_library() command with the MODULE option. ... ]]] This means that when changing the LIBRARY property to `lib`, we actually put DLL files into this directory, which is incorrect and causes the problem. I'd like to suggest the following; First, there is already a macro for declaring modules, so install invocation can be called from there directly, using the correct destination path, instead of collecting a list of targets to install. In this way we can set up the install properly and resolve the issue. Then also a minor improvement in installation sequence can be done, since it is required to call it a single time, only for the libaprutil-1 target. This worked perfectly for me, and the cmake file seemed a little cleaner after this work. See the patch attached to this email, which represents those fixes. [1] https://cmake.org/cmake/help/latest/manual/cmake-buildsystem.7.html#module-libraries [2] https://cmake.org/cmake/help/latest/manual/cmake-buildsystem.7.html#library-output-artifacts WDYT? -- Timofei Zhakov
Index: CMakeLists.txt =================================================================== --- CMakeLists.txt (revision 1925665) +++ CMakeLists.txt (working copy) @@ -287,7 +287,6 @@ MACRO(ADD_APU_MODULE name dllname sources libraries) IF(APU_DSO_BUILD) ADD_LIBRARY(${name} MODULE ${sources}) - LIST(APPEND install_targets ${name}) LIST(APPEND install_bin_pdb $<TARGET_PDB_FILE:${name}>) TARGET_SOURCES(${name} PRIVATE libaprutil.rc) @@ -298,6 +297,7 @@ PRIVATE libaprutil-1 apr::libapr-1) TARGET_LINK_LIBRARIES(${name} PRIVATE ${libraries}) + INSTALL(TARGETS ${name} DESTINATION ${APU_INSTALL_BIN_DIR}) ELSE() LIST(APPEND APU_EXTRA_SOURCES ${sources}) LIST(APPEND APU_EXTRA_LIBRARIES ${libraries}) @@ -350,7 +350,11 @@ ENDIF() ADD_LIBRARY(libaprutil-1 ${APR_SOURCES} ${APU_EXTRA_SOURCES} ${APR_PUBLIC_HEADERS_GENERATED}) -LIST(APPEND install_targets libaprutil-1) +INSTALL(TARGETS libaprutil-1 + RUNTIME DESTINATION ${APU_INSTALL_BIN_DIR} + LIBRARY DESTINATION ${APU_INSTALL_LIB_DIR} + ARCHIVE DESTINATION ${APU_INSTALL_LIB_DIR} + ) TARGET_LINK_LIBRARIES(libaprutil-1 PRIVATE ${XMLLIB_LIBRARIES} ${XLATE_LIBRARIES} ${APU_EXTRA_LIBRARIES}) TARGET_INCLUDE_DIRECTORIES(libaprutil-1 @@ -433,14 +437,6 @@ ADD_DEPENDENCIES(testall memcachedmock) ENDIF (APU_BUILD_TEST) -# Installation - -INSTALL(TARGETS ${install_targets} - RUNTIME DESTINATION ${APU_INSTALL_BIN_DIR} - LIBRARY DESTINATION ${APU_INSTALL_LIB_DIR} - ARCHIVE DESTINATION ${APU_INSTALL_LIB_DIR} - ) - IF(INSTALL_PDB) INSTALL(FILES ${install_bin_pdb} DESTINATION ${APU_INSTALL_BIN_DIR}