Allow zlib through find_package
This commit is contained in:
parent
cd4fa0dd0c
commit
1ee7f68850
33
bundled/libdwarf/CMakeLists.txt
vendored
33
bundled/libdwarf/CMakeLists.txt
vendored
@ -217,8 +217,13 @@ check_c_source_compiles([=[
|
|||||||
}]=] HAVE_STDAFX_H)
|
}]=] HAVE_STDAFX_H)
|
||||||
#message(STATUS "Checking have windows stdafx.h... ${HAVE_STDAFX_H}")
|
#message(STATUS "Checking have windows stdafx.h... ${HAVE_STDAFX_H}")
|
||||||
|
|
||||||
set(CMAKE_REQUIRED_LIBRARIES z)
|
option(CMAKE_DWARF_FINDPACKAGE_Z "" OFF)
|
||||||
check_c_source_compiles( [=[
|
|
||||||
|
mark_as_advanced(CMAKE_DWARF_FINDPACKAGE_Z)
|
||||||
|
|
||||||
|
if(NOT CMAKE_DWARF_FINDPACKAGE_Z)
|
||||||
|
set(CMAKE_REQUIRED_LIBRARIES z)
|
||||||
|
check_c_source_compiles( [=[
|
||||||
#include "zlib.h"
|
#include "zlib.h"
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
@ -232,7 +237,7 @@ check_c_source_compiles( [=[
|
|||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
} ]=] HAVE_ZLIB )
|
} ]=] HAVE_ZLIB )
|
||||||
check_c_source_compiles( [=[
|
check_c_source_compiles( [=[
|
||||||
#include "zlib.h"
|
#include "zlib.h"
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
@ -246,14 +251,14 @@ check_c_source_compiles( [=[
|
|||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
} ]=] HAVE_ZLIB_H )
|
} ]=] HAVE_ZLIB_H )
|
||||||
set(CMAKE_REQUIRED_LIBRARIES)
|
set(CMAKE_REQUIRED_LIBRARIES)
|
||||||
if (HAVE_ZLIB)
|
if (HAVE_ZLIB)
|
||||||
# For linking in libz
|
# For linking in libz
|
||||||
set(DW_FZLIB "z")
|
set(DW_FZLIB "z")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(CMAKE_REQUIRED_LIBRARIES zstd )
|
set(CMAKE_REQUIRED_LIBRARIES zstd )
|
||||||
check_c_source_compiles( [=[
|
check_c_source_compiles( [=[
|
||||||
#include "zstd.h"
|
#include "zstd.h"
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
@ -267,7 +272,7 @@ check_c_source_compiles( [=[
|
|||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
} ]=] HAVE_ZSTD )
|
} ]=] HAVE_ZSTD )
|
||||||
check_c_source_compiles( [=[
|
check_c_source_compiles( [=[
|
||||||
#include "zstd.h"
|
#include "zstd.h"
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
@ -281,10 +286,14 @@ check_c_source_compiles( [=[
|
|||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
} ]=] HAVE_ZSTD_H )
|
} ]=] HAVE_ZSTD_H )
|
||||||
set(CMAKE_REQUIRED_LIBRARIES)
|
set(CMAKE_REQUIRED_LIBRARIES)
|
||||||
if (HAVE_ZSTD)
|
if (HAVE_ZSTD)
|
||||||
# For linking in libzstd
|
# For linking in libzstd
|
||||||
set(DW_FZSTD "zstd")
|
set(DW_FZSTD "zstd")
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
find_package(z REQUIRED)
|
||||||
|
set(DW_FZLIB "z")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
check_c_source_compiles([=[
|
check_c_source_compiles([=[
|
||||||
@ -434,7 +443,7 @@ target_include_directories(
|
|||||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(dwarf PUBLIC ${LIBELF_LIBRARIES} ${DW_FZLIB} ${DW_FZSTD})
|
target_link_libraries(dwarf PUBLIC ${DW_FZLIB} ${DW_FZSTD})
|
||||||
|
|
||||||
# TODO: Something will have to be figured out for dynamic linking, but for now there's nothing to install
|
# TODO: Something will have to be figured out for dynamic linking, but for now there's nothing to install
|
||||||
# if(NOT CMAKE_SKIP_INSTALL_RULES)
|
# if(NOT CMAKE_SKIP_INSTALL_RULES)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user