Skip to content

Commit 4376498

Browse files
committed
Allow changing default of build examples
1 parent 29f0ce5 commit 4376498

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

CMakeLists.txt

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,12 @@ project (raylib-cpp
77
LANGUAGES C CXX)
88

99
# Options
10-
option(BUILD_RAYLIB_CPP_EXAMPLES "Examples" ON)
10+
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
11+
set(BUILD_RAYLIB_CPP_EXAMPLES_DEFAULT TRUE)
12+
else()
13+
set(BUILD_RAYLIB_CPP_EXAMPLES_DEFAULT FALSE)
14+
endif()
15+
option(BUILD_RAYLIB_CPP_EXAMPLES "Examples" ${BUILD_RAYLIB_CPP_EXAMPLES_DEFAULT})
1116

1217
# Include Directory
1318
add_subdirectory(include)
@@ -16,14 +21,14 @@ add_subdirectory(include)
1621
if(BUILD_RAYLIB_CPP_EXAMPLES)
1722
add_subdirectory(examples)
1823
set(BUILD_RAYLIB_CPP_STATIC ON)
19-
endif()
2024

21-
# Testing
22-
include(CTest)
23-
enable_testing()
24-
if(BUILD_TESTING AND BUILD_RAYLIB_CPP_EXAMPLES)
25-
set(CTEST_CUSTOM_TESTS_IGNORE
26-
pkg-config--static
27-
)
28-
add_subdirectory(tests)
25+
# Testing
26+
include(CTest)
27+
enable_testing()
28+
if(BUILD_TESTING)
29+
set(CTEST_CUSTOM_TESTS_IGNORE
30+
pkg-config--static
31+
)
32+
add_subdirectory(tests)
33+
endif()
2934
endif()

0 commit comments

Comments
 (0)