Skip to content

Commit

Permalink
[libromdata] CMakeLists: Link most dependencies in PRIVATE instead of…
Browse files Browse the repository at this point in the history
… PUBLIC.

I've noticed that with the `mold` linker, the dependent libraries end up
being included in .so files that don't actually use them. There's probably
some option in `mold` to fix this, but since these libraries aren't
actually used directly by e.g. the KDE XAttrView libraries, make them
PRIVATE instead of PUBLIC.
  • Loading branch information
GerbilSoft committed Sep 8, 2024
1 parent 6f762d7 commit 2aedcdf
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/libromdata/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -715,33 +715,33 @@ ENDIF(WIN32)
# NOTE: Nettle isn't used directly, but librpbase is PRIVATE if
# libromdata is built as a shared library.
IF(ZLIB_FOUND)
TARGET_LINK_LIBRARIES(${PROJECT_NAME} PUBLIC ${ZLIB_LIBRARIES})
TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} PUBLIC ${ZLIB_INCLUDE_DIRS})
TARGET_COMPILE_DEFINITIONS(${PROJECT_NAME} PUBLIC ${ZLIB_DEFINITIONS})
TARGET_LINK_LIBRARIES(${PROJECT_NAME} PRIVATE ${ZLIB_LIBRARIES})
TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} PRIVATE ${ZLIB_INCLUDE_DIRS})
TARGET_COMPILE_DEFINITIONS(${PROJECT_NAME} PRIVATE ${ZLIB_DEFINITIONS})
ELSE(ZLIB_FOUND)
MESSAGE(FATAL_ERROR "ZLIB_LIBRARIES has not been set by CheckZLIB.cmake.")
ENDIF(ZLIB_FOUND)
IF(PNG_FOUND)
TARGET_LINK_LIBRARIES(${PROJECT_NAME} PUBLIC ${PNG_LIBRARY})
TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} PUBLIC ${PNG_INCLUDE_DIRS})
TARGET_COMPILE_DEFINITIONS(${PROJECT_NAME} PUBLIC ${PNG_DEFINITIONS})
TARGET_LINK_LIBRARIES(${PROJECT_NAME} PRIVATE ${PNG_LIBRARY})
TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} PRIVATE ${PNG_INCLUDE_DIRS})
TARGET_COMPILE_DEFINITIONS(${PROJECT_NAME} PRIVATE ${PNG_DEFINITIONS})
ENDIF(PNG_FOUND)
IF(JPEG_FOUND)
TARGET_LINK_LIBRARIES(${PROJECT_NAME} PUBLIC ${JPEG_LIBRARY})
TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} PUBLIC ${JPEG_INCLUDE_DIRS})
TARGET_LINK_LIBRARIES(${PROJECT_NAME} PRIVATE ${JPEG_LIBRARY})
TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} PRIVATE ${JPEG_INCLUDE_DIRS})
ENDIF(JPEG_FOUND)
IF(ENABLE_DECRYPTION AND NOT WIN32)
INCLUDE(CheckNettle2or3)
CHECK_NETTLE_2_OR_3()
IF(NETTLE_FOUND)
TARGET_LINK_LIBRARIES(${PROJECT_NAME} PUBLIC ${NETTLE_LIBRARY})
TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} PUBLIC ${NETTLE_INCLUDE_DIRS})
TARGET_LINK_LIBRARIES(${PROJECT_NAME} PRIVATE ${NETTLE_LIBRARY})
TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} PRIVATE ${NETTLE_INCLUDE_DIRS})
ENDIF(NETTLE_FOUND)
ENDIF(ENABLE_DECRYPTION AND NOT WIN32)

IF(ENABLE_XML AND TinyXML2_FOUND)
TARGET_LINK_LIBRARIES(${PROJECT_NAME} PUBLIC ${TinyXML2_LIBRARY})
TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} PUBLIC ${TinyXML2_INCLUDE_DIR})
TARGET_LINK_LIBRARIES(${PROJECT_NAME} PRIVATE ${TinyXML2_LIBRARY})
TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} PRIVATE ${TinyXML2_INCLUDE_DIR})
ENDIF(ENABLE_XML AND TinyXML2_FOUND)

IF(ENABLE_UNICE68)
Expand Down

0 comments on commit 2aedcdf

Please sign in to comment.