Skip to content

Commit

Permalink
Merge pull request #10 from bzizou/nix
Browse files Browse the repository at this point in the history
Disable the local build of htslib if HTSLIB_DIR is provided
  • Loading branch information
lczech authored Mar 14, 2024
2 parents 5c02a6a + 42d9677 commit 3164082
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions tools/cmake/IncludeHtslib.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@
# This file is included from the main CMakeLists.txt in order to build htslib.
message (STATUS "Looking for htslib")
cmake_minimum_required( VERSION 3.1 )
include(ExternalProject)
if(NOT DEFINED HTSLIB_DIR)
include(ExternalProject)
endif()

# ==================================================================================================
# Check for autotools
Expand Down Expand Up @@ -195,7 +197,8 @@ endif()

# We download and built on our own, using the correct commit hash to get our exact desired
# version, and install locally to the build directory.
ExternalProject_Add(
if(NOT DEFINED HTSLIB_DIR)
ExternalProject_Add(
htslib
PREFIX ""

Expand Down Expand Up @@ -243,11 +246,14 @@ ExternalProject_Add(

# Install Step
INSTALL_COMMAND $(MAKE) install
)
)
endif()

# Set the paths so that those can be included by the targets.
# We explicitly set the static library here, so that we link against that one.
set( HTSLIB_DIR "${CMAKE_CURRENT_BINARY_DIR}/genesis-htslib" )
if(NOT DEFINED HTSLIB_DIR)
set( HTSLIB_DIR "${CMAKE_CURRENT_BINARY_DIR}/genesis-htslib" )
endif()
set( HTSLIB_INCLUDE_DIR "${HTSLIB_DIR}/include" )
set( HTSLIB_LINK_DIR "${HTSLIB_DIR}/lib" )
set( HTSLIB_LIBRARY "${HTSLIB_DIR}/lib/libhts.a" )
Expand Down

0 comments on commit 3164082

Please sign in to comment.