Skip to content

Commit 85e40bb

Browse files
committed
cmake: move the rule to find static archives close to building clar
If we're building static libraries, we want to use that for building our clar binary. This is done in 4955125 (2017-09-22; cmake: use static dependencies when building static libgit2) but that commit included the rule too early, making it affect the search for iconv, meaning we did not find it when we were building a static libgit2. Move the rule to just before building clar, after we've included the rules for building the library itself. This lets us find and link to the dynamic libiconv.
1 parent eebc5e0 commit 85e40bb

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

CMakeLists.txt

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -222,10 +222,6 @@ IF (MSVC)
222222
SET(CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO}")
223223
SET(CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL "${CMAKE_EXE_LINKER_FLAGS_MINSIZEREL}")
224224
ELSE ()
225-
IF (NOT BUILD_SHARED_LIBS)
226-
SET(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
227-
ENDIF()
228-
229225
IF (ENABLE_REPRODUCIBLE_BUILDS)
230226
SET(CMAKE_C_ARCHIVE_CREATE "<CMAKE_AR> Dqc <TARGET> <LINK_FLAGS> <OBJECTS>")
231227
SET(CMAKE_C_ARCHIVE_APPEND "<CMAKE_AR> Dq <TARGET> <LINK_FLAGS> <OBJECTS>")
@@ -304,6 +300,12 @@ ENDIF()
304300
ADD_SUBDIRECTORY(src)
305301

306302
# Tests
303+
IF (NOT MSVC)
304+
IF (NOT BUILD_SHARED_LIBS)
305+
SET(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
306+
ENDIF()
307+
ENDIF ()
308+
307309
IF (BUILD_CLAR)
308310
ENABLE_TESTING()
309311
ADD_SUBDIRECTORY(tests)

0 commit comments

Comments
 (0)