From 9bb9d67da0e4faf4bb3a47786dee127e66a49ed0 Mon Sep 17 00:00:00 2001
From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Date: Sun, 3 Sep 2017 15:22:30 +0200
Subject: [PATCH] CMakeLists.txt: don't force the build of a shared library

Building a shared library doesn't work on all platforms, so instead,
let CMake rely on the standard BUILD_SHARED_LIBS variable to decide
whether a static or shared library should be built.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Submitted-upstream: https://github.com/rafaelsteil/libcgi/pull/39
---
 src/CMakeLists.txt | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index f32d22e..3bde408 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -23,17 +23,18 @@ set(CGI_SRC
 )
 
 # create binary
-add_library(${PROJECT_NAME}-shared SHARED ${CGI_SRC})
-set_target_properties(${PROJECT_NAME}-shared PROPERTIES
+add_library(${PROJECT_NAME} ${CGI_SRC})
+set_target_properties(${PROJECT_NAME} PROPERTIES
 	OUTPUT_NAME	${PROJECT_NAME}
 	SOVERSION	${PROJECT_VERSION_MAJOR}
 	VERSION		${PROJECT_VERSION}
 )
 
 # install binary
-install(TARGETS ${PROJECT_NAME}-shared
+install(TARGETS ${PROJECT_NAME}
 	EXPORT ${PROJECT_NAME}-targets
 	LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
+	ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
 )
 
 # install cmake targets
-- 
2.13.5

