summaryrefslogtreecommitdiffhomepage
path: root/src/CMakeLists.txt
diff options
context:
space:
mode:
authorhristo <[email protected]>2021-01-22 01:07:22 +0200
committerGitHub <[email protected]>2021-01-22 00:07:22 +0100
commit05dfbf3cd42e63f56d978cafec63f22fd7538e9f (patch)
tree79ec578f96f053fb89ebdce97b1b79a02b52581d /src/CMakeLists.txt
parent18ab694f703ee4b185935b5bdd5a533ea05933d2 (diff)
downloadraylib-05dfbf3cd42e63f56d978cafec63f22fd7538e9f.tar.gz
raylib-05dfbf3cd42e63f56d978cafec63f22fd7538e9f.zip
Remove STATIC and SHARED variables. (#1542)
As described in the official documentation https://cmake.org/cmake/help/v3.0/variable/BUILD_SHARED_LIBS.html this flag is global by default and controls if the library will be built as a shared or a static library allowing us to define only one call to the add_library function (without specifying its type). It is also added as an option to be visible in CMake GUI applications.
Diffstat (limited to 'src/CMakeLists.txt')
-rw-r--r--src/CMakeLists.txt20
1 files changed, 7 insertions, 13 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 3319ef03..f6416dfe 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -51,29 +51,23 @@ include(LibraryConfigurations)
set(LIBS_PRIVATE ${LIBS_PRIVATE} ${OPENAL_LIBRARY})
-if (STATIC)
+add_library(raylib ${raylib_sources} ${raylib_public_headers})
+
+if (NOT BUILD_SHARED_LIBS)
MESSAGE(STATUS "Building raylib static library")
-
- add_library(raylib STATIC ${raylib_sources} ${raylib_public_headers})
add_library(raylib_static ALIAS raylib)
-
add_test("pkg-config--static" ${PROJECT_SOURCE_DIR}/../cmake/test-pkgconfig.sh --static)
-endif (STATIC)
-
-
-if (SHARED)
+else()
MESSAGE(STATUS "Building raylib shared library")
- add_library(raylib SHARED ${raylib_sources} ${raylib_public_headers})
-
if (MSVC)
target_compile_definitions(raylib
PRIVATE $<BUILD_INTERFACE:BUILD_LIBTYPE_SHARED>
INTERFACE $<INSTALL_INTERFACE:USE_LIBTYPE_SHARED>
)
endif ()
-
+
add_test("pkg-config" ${PROJECT_SOURCE_DIR}/../cmake/test-pkgconfig.sh)
-endif ()
+endif()
# Setting target properties
set_target_properties(raylib PROPERTIES
@@ -82,7 +76,7 @@ set_target_properties(raylib PROPERTIES
SOVERSION ${API_VERSION}
)
-if (WITH_PIC OR SHARED)
+if (WITH_PIC OR BUILD_SHARED_LIBS)
set_property(TARGET raylib PROPERTY POSITION_INDEPENDENT_CODE ON)
endif ()