44#
55# Authors: Andrew D. Smith
66#
7- # This is free software: you can redistribute it and/or modify it
8- # under the terms of the GNU General Public License as published by
9- # the Free Software Foundation, either version 3 of the License, or
10- # (at your option) any later version.
7+ # This is free software: you can redistribute it and/or modify it under the
8+ # terms of the GNU General Public License as published by the Free Software
9+ # Foundation, either version 3 of the License, or (at your option) any later
10+ # version.
1111#
12- # This software is distributed in the hope that it will be useful, but
13- # WITHOUT ANY WARRANTY; without even the implied warranty of
14- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15- # General Public License for more details.
12+ # This software is distributed in the hope that it will be useful, but WITHOUT
13+ # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14+ # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15+ # more details.
1616
1717# to find the version of cmake do
1818# $ cmake --version
@@ -41,96 +41,6 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
4141
4242configure_file (data/config.h.in config.h )
4343
44- # Collect any global linker options as needed and then apply them
45- # individually to targets
46- set (GLOBAL_COMPILE_OPTIONS "" )
47- set (GLOBAL_LINKER_OPTIONS "" )
48-
49- if (USE_STATIC_LIBS)
50- # This needs to come before finding any libraries so that the static
51- # versions are identified
52- message (STATUS "Enabling static linkage for all non-system libraries" )
53- message (STATUS "Configuring to clone ZLib" )
54- include (ExternalProject )
55- set (ZLIB_CMAKE_ARGS
56- -DZLIB_BUILD_EXAMPLES=off
57- -DSKIP_INSTALL_FILES=on
58- -DCMAKE_POSITION_INDEPENDENT_CODE=on
59- -DCMAKE_INSTALL_PREFIX=${PROJECT_BINARY_DIR} /src/zlib
60- -DCMAKE_BUILD_TYPE=Release
61- )
62- if (CMAKE_SYSTEM_NAME STREQUAL "Darwin" )
63- list (APPEND ZLIB_CMAKE_ARGS
64- -DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}
65- )
66- endif ()
67- ExternalProject_Add (
68- ZLIB
69- GIT_REPOSITORY https://github.com/madler/zlib.git
70- GIT_TAG master
71- CMAKE_ARGS ${ZLIB_CMAKE_ARGS}
72- )
73- # Include the built zlib headers and link against the built zlib library
74- set (ZLIB_INCLUDE_DIR "${PROJECT_BINARY_DIR} /src/zlib/include" )
75- set (ZLIB_LIBRARY "${PROJECT_BINARY_DIR} /src/zlib/lib/libz.a" )
76-
77- # Create the CMake target for the built zlib
78- add_library (ZLIB_IMPORTED INTERFACE )
79- set_target_properties (ZLIB_IMPORTED PROPERTIES
80- INTERFACE_INCLUDE_DIRECTORIES ${ZLIB_INCLUDE_DIR}
81- INTERFACE_LINK_LIBRARIES ${ZLIB_LIBRARY}
82- )
83-
84- # This alias means we don't need to worry where zlib came from
85- add_library (ZLIB::ZLIB ALIAS ZLIB_IMPORTED )
86-
87- ExternalProject_Add (
88- HTSLIB
89- GIT_REPOSITORY https://github.com/samtools/htslib.git
90- GIT_TAG master
91- CONFIGURE_COMMAND ""
92- # "autoreconf -i <SOURCE_DIR>; <SOURCE_DIR>/configure"
93- BUILD_COMMAND make -C <SOURCE_DIR > lib-static -j
94- INSTALL_COMMAND ""
95- # make install
96- TEST_COMMAND ""
97- BUILD_BYPRODUCTS libhts.a
98- )
99- # ExternalProject_Add_Step(HTSLIB
100- # bootstrap
101- # COMMAND autoreconf -i <SOURCE_DIR>
102- # DEPENDEES download
103- # DEPENDERS configure
104- # )
105- ExternalProject_Get_Property (HTSLIB SOURCE_DIR )
106- message (STATUS "SOURCE_DIR: ${SOURCE_DIR} " )
107-
108- # Include the built zlib headers and link against the built zlib library
109- set (HTSLIB_INCLUDE_DIR "${SOURCE_DIR} /src/htslib/htslib" )
110- set (HTSLIB_LIBRARY "${SOURCE_DIR} /htslib.a" )
111-
112- # Create the CMake target for the built zlib
113- add_library (HTSLIB_IMPORTED INTERFACE )
114- set_target_properties (HTSLIB_IMPORTED PROPERTIES
115- INTERFACE_INCLUDE_DIRECTORIES ${HTSLIB_INCLUDE_DIR}
116- INTERFACE_LINK_LIBRARIES ${HTSLIB_LIBRARY}
117- )
118- set_target_properties (HTSLIB_IMPORTED PROPERTIES IMPORTED_LOCATION ${HTSLIB_LIBRARY} )
119-
120- # This alias means we don't need to worry where htslib came from
121- add_library (HTSLIB::HTSLIB ALIAS HTSLIB_IMPORTED )
122-
123- # Set static for the linker so the compiler's libraries will be static
124- ## ADS: using this instead of forcing -static for everything avoids the
125- ## static linkage that Aiso warns against, but also means it's not 100%
126- ## static linked ADS: can't do this if the compiler is AppleClang because
127- ## they don't have the libc++.a and the libgcc wouldn't make sense anyway.
128- if (NOT CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang" ) # macOS
129- list (APPEND GLOBAL_LINKER_OPTIONS -static-libgcc -static-libstdc++)
130- endif ()
131-
132- endif ()
133-
13444if (ENABLE_LTO)
13545 # Turn on LTO if we are building for distribution
13646 include (CheckIPOSupported )
@@ -147,17 +57,12 @@ if(STATIC_ANALYSIS)
14757endif ()
14858
14959# ADS: set the most stringent warnings we can
150- list (APPEND GLOBAL_COMPILE_OPTIONS
151- -Wall -Wextra -Wpedantic -Werror -Wfatal-errors
60+ add_compile_options (
61+ -Wall
62+ -Wextra
63+ -Wpedantic
64+ -Werror
65+ -Wfatal-errors
15266)
15367
154- if (STRIP_PATHS_FROM_BINARIES)
155- # This is set if we have configured to distribute
156- set (PREFIX_MAP_ARG -ffile-prefix-map=)
157- list (TRANSFORM STRIP_SUB_LIST PREPEND ${PREFIX_MAP_ARG} )
158- list (APPEND GLOBAL_COMPILE_OPTIONS ${STRIP_SUB_LIST} )
159- endif ()
160-
161- message (STATUS "Finished global compile and linker configuration" )
162-
16368add_subdirectory (src )
0 commit comments