Commit ddd36510b589f8dd39a9bfaaecfb9160dc943f42

Carlos Martín Nieto 2018-01-07T15:40:06

Merge pull request #4467 from libgit2/cmn/static-archive-later cmake: move the rule to find static archives close to building clar

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 48a4d91..d4b3136 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -222,10 +222,6 @@ IF (MSVC)
 	SET(CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO}")
 	SET(CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL "${CMAKE_EXE_LINKER_FLAGS_MINSIZEREL}")
 ELSE ()
-	IF (NOT BUILD_SHARED_LIBS)
-		SET(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
-	ENDIF()
-
 	IF (ENABLE_REPRODUCIBLE_BUILDS)
 		SET(CMAKE_C_ARCHIVE_CREATE "<CMAKE_AR> Dqc <TARGET> <LINK_FLAGS> <OBJECTS>")
 		SET(CMAKE_C_ARCHIVE_APPEND "<CMAKE_AR> Dq  <TARGET> <LINK_FLAGS> <OBJECTS>")
@@ -304,6 +300,12 @@ ENDIF()
 ADD_SUBDIRECTORY(src)
 
 # Tests
+IF (NOT MSVC)
+   IF (NOT BUILD_SHARED_LIBS)
+       SET(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
+   ENDIF()
+ENDIF ()
+
 IF (BUILD_CLAR)
 	ENABLE_TESTING()
 	ADD_SUBDIRECTORY(tests)