mirror of
https://github.com/raysan5/raylib.git
synced 2025-10-08 02:46:28 +00:00
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.
This commit is contained in:
@@ -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 ()
|
||||
|
||||
|
Reference in New Issue
Block a user