Private
Public Access
2
0

cmake: build shared libs by default on linux

The change allows to build shared libraries by default on Linux, while
respecting the requested library build type when the standard CMake flag
BUILD_SHARED_LIBS is defined.

Signed-off-by: Samuel Martin <s.martin49@gmail.com>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
This commit is contained in:
Samuel Martin
2016-01-06 01:07:10 +01:00
committed by Brendan Le Foll
parent 7f85f2bbdb
commit 86a0e10c03
2 changed files with 8 additions and 1 deletions

View File

@@ -10,6 +10,13 @@ set (LIB_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}" CACHE PATH "Installation path for
# Set CMAKE_LIB_INSTALL_DIR if not defined
include(GNUInstallDirs)
# By default, build shared object libraries on linux
if (UNIX AND NOT APPLE)
if (NOT DEFINED BUILD_SHARED_LIBS)
set(BUILD_SHARED_LIBS ON)
endif()
endif()
# Appends the cmake/modules path to MAKE_MODULE_PATH variable.
set (CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules ${CMAKE_MODULE_PATH})

View File

@@ -111,7 +111,7 @@ set (mraa_LIB_GLOB_HEADERS
${PROJECT_SOURCE_DIR}/api/mraa.hpp
)
add_library (mraa SHARED ${mraa_LIB_SRCS})
add_library (mraa ${mraa_LIB_SRCS})
target_link_libraries (mraa ${mraa_LIBS})