-
I'm trying to compile a project, which uses zlib-ng as a third party library (not in compat mode) using CMake with:
CMake configuration: set(ZLIB_ENABLE_TESTS ON)
set(ZLIB_NG_BUILD_SHARED_LIBS OFF)
set(ZLIB_NG_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src/thirdparty/zlib-ng")
set(ZLIB_NG_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/src/thirdparty/zlib-ng")
add_subdirectory(${ZLIB_NG_SOURCE_DIR} ${ZLIB_NG_BINARY_DIR} EXCLUDE_FROM_ALL)
set(ZLIB_NG_INCLUDE_DIR ${CMAKE_CURRENT_BINARY_DIR}/zlib-ng CACHE STRING "Path to zlib include directory")
set(ZLIB_NG_LIBRARY ${CMAKE_CURRENT_BINARY_DIR}/zlib-ng CACHE STRING "Path to zlib directory")
include_directories(${ZLIB_NG_BINARY_DIR})
include_directories(${ZLIB_NG_SOURCE_DIR})
set(ZLIB_NG "libz-ng")
target_link_libraries (PROJECT_NAME ${ZLIB_NG}) I'm getting an error What am I doing wrong? |
Beta Was this translation helpful? Give feedback.
Answered by
nmoinvaz
Feb 13, 2023
Replies: 1 comment 2 replies
-
I think target_link_libraries needs the name of the CMake project (ie zlib), instead of the name of the library output; probably due to EXCLUDE_FROM_ALL. |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
kbieniex
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I think target_link_libraries needs the name of the CMake project (ie zlib), instead of the name of the library output; probably due to EXCLUDE_FROM_ALL.