File tree Expand file tree Collapse file tree 2 files changed +34
-5
lines changed Expand file tree Collapse file tree 2 files changed +34
-5
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,12 @@ include(GNUInstallDirs)
23
23
# include the configuration file
24
24
include (${PROJECT_SOURCE_DIR} /cmake/Config.cmake )
25
25
26
+ # add options to select which modules to build
27
+ 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." )
28
+ csfml_set_option (CSFML_BUILD_GRAPHICS TRUE BOOL "TRUE to build CSFML's Graphics module." )
29
+ csfml_set_option (CSFML_BUILD_AUDIO TRUE BOOL "TRUE to build CSFML's Audio module." )
30
+ csfml_set_option (CSFML_BUILD_NETWORK TRUE BOOL "TRUE to build CSFML's Network module." )
31
+
26
32
# add an option for choosing the build type (shared or static)
27
33
csfml_set_option (BUILD_SHARED_LIBS TRUE BOOL "TRUE to build CSFML as shared libraries, FALSE to build it as static libraries" )
28
34
Original file line number Diff line number Diff line change @@ -21,14 +21,37 @@ if(CSFML_LINK_SFML_STATICALLY)
21
21
set (SFML_STATIC_LIBRARIES TRUE )
22
22
add_definitions (-DSFML_STATIC )
23
23
endif ()
24
- find_package (SFML 2.6 COMPONENTS network graphics audio REQUIRED )
24
+ set (SFML_MODULES "system" )
25
+ if (CSFML_BUILD_AUDIO )
26
+ list (PREPEND SFML_MODULES "audio" )
27
+ endif ()
28
+ if (CSFML_BUILD_GRAPHICS )
29
+ list (PREPEND SFML_MODULES "graphics" )
30
+ endif ()
31
+ if (CSFML_BUILD_NETWORK )
32
+ list (PREPEND SFML_MODULES "network" )
33
+ endif ()
34
+ find_package (SFML 2.6 COMPONENTS ${SFML_MODULES} REQUIRED )
25
35
26
36
# add the modules subdirectories
27
37
add_subdirectory (System )
28
- add_subdirectory (Window )
29
- add_subdirectory (Network )
30
- add_subdirectory (Graphics )
31
- add_subdirectory (Audio )
38
+
39
+ if (CSFML_BUILD_WINDOW OR SFML_BUILD_GRAPHICS )
40
+ add_subdirectory (Window )
41
+ endif ()
42
+
43
+ if (CSFML_BUILD_NETWORK )
44
+ add_subdirectory (Network )
45
+ endif ()
46
+
47
+ if (CSFML_BUILD_GRAPHICS )
48
+ add_subdirectory (Graphics )
49
+ endif ()
50
+
51
+ if (CSFML_BUILD_AUDIO )
52
+ add_subdirectory (Audio )
53
+ endif ()
54
+
32
55
if (SFML_OS_WINDOWS )
33
56
add_subdirectory (Main )
34
57
endif ()
You can’t perform that action at this time.
0 commit comments