Add options to select the modules to build

This commit is contained in:
Lukas Dürrenberger committed 2024-05-18 15:44:02 +02:00
1 parent 8c02b89a93
commit 2ec9764ac4
2 files changed
+30 -1

No files matched your search

+6
View File
@@ -23,6 +23,12 @@ include(GNUInstallDirs)
# include the configuration file
include(${PROJECT_SOURCE_DIR}/cmake/Config.cmake)
# add options to select which modules to build
csfml_set_option(CSFML_BUILD_WINDOW TRUE BOOL "TRUE to build CSFML's Window module. This setting is ignored, if the graphics module is built.")
csfml_set_option(CSFML_BUILD_GRAPHICS TRUE BOOL "TRUE to build CSFML's Graphics module.")
csfml_set_option(CSFML_BUILD_AUDIO TRUE BOOL "TRUE to build CSFML's Audio module.")
csfml_set_option(CSFML_BUILD_NETWORK TRUE BOOL "TRUE to build CSFML's Network module.")
# add an option for choosing the build type (shared or static)
csfml_set_option(BUILD_SHARED_LIBS TRUE BOOL "TRUE to build CSFML as shared libraries, FALSE to build it as static libraries")
+24 -1
View File
@@ -21,14 +21,37 @@ if(CSFML_LINK_SFML_STATICALLY)
set(SFML_STATIC_LIBRARIES TRUE)
add_definitions(-DSFML_STATIC)
endif()
find_package(SFML 2.6 COMPONENTS network graphics audio REQUIRED)
set(SFML_MODULES "system")
if(CSFML_BUILD_AUDIO)
list(PREPEND SFML_MODULES "audio")
endif()
if(CSFML_BUILD_GRAPHICS)
list(PREPEND SFML_MODULES "graphics")
endif()
if(CSFML_BUILD_NETWORK)
list(PREPEND SFML_MODULES "network")
endif()
find_package(SFML 2.6 COMPONENTS ${SFML_MODULES} REQUIRED)
# add the modules subdirectories
add_subdirectory(System)
if(CSFML_BUILD_WINDOW OR SFML_BUILD_GRAPHICS)
add_subdirectory(Window)
endif()
if(CSFML_BUILD_NETWORK)
add_subdirectory(Network)
endif()
if(CSFML_BUILD_GRAPHICS)
add_subdirectory(Graphics)
endif()
if(CSFML_BUILD_AUDIO)
add_subdirectory(Audio)
endif()
if(SFML_OS_WINDOWS)
add_subdirectory(Main)
endif()