aboutsummaryrefslogtreecommitdiff
path: root/dep/bzip2/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'dep/bzip2/CMakeLists.txt')
-rw-r--r--dep/bzip2/CMakeLists.txt33
1 files changed, 24 insertions, 9 deletions
diff --git a/dep/bzip2/CMakeLists.txt b/dep/bzip2/CMakeLists.txt
index d3aadbe002e..d5a7414f383 100644
--- a/dep/bzip2/CMakeLists.txt
+++ b/dep/bzip2/CMakeLists.txt
@@ -8,15 +8,30 @@
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-file(GLOB sources *.c)
+if(UNIX)
+ # Look for an installed bzip2 on unix
+ find_package(BZip2 REQUIRED)
-set(bzip2_STAT_SRCS
- ${sources}
-)
+ add_library(bzip2 SHARED IMPORTED GLOBAL)
-include_directories(
- ${CMAKE_SOURCE_DIR}/dep/zlib
- ${CMAKE_CURRENT_SOURCE_DIR}
-)
+ set_target_properties(bzip2
+ PROPERTIES
+ IMPORTED_LOCATION
+ "${BZIP2_LIBRARIES}"
+ INTERFACE_INCLUDE_DIRECTORIES
+ "${BZIP2_INCLUDE_DIRS}")
+else()
+ # Use the bundled source on windows
+ file(GLOB sources *.c)
+ add_library(bzip2 STATIC
+ ${sources})
-add_library(bzip2 STATIC ${bzip2_STAT_SRCS})
+ target_include_directories(bzip2
+ PUBLIC
+ ${CMAKE_CURRENT_SOURCE_DIR})
+
+ set_target_properties(bzip2
+ PROPERTIES
+ FOLDER
+ "dep")
+endif()