Skip to content

Commit c2126d0

Browse files
Merge pull request nextgeniuspro#19 from psyinf/cmake_improvements
Optional build of examples
2 parents 3a0c542 + e920ac3 commit c2126d0

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

CMakeLists.txt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.10)
22

33
# Project name and version
44
project(vfspp VERSION 1.0 LANGUAGES CXX)
5-
5+
option(BUILD_EXAMPLES "Build examples" OFF)
66
# Add the miniz-cpp library
77
add_subdirectory(vendor/miniz-cpp EXCLUDE_FROM_ALL)
88

@@ -13,6 +13,7 @@ set(CMAKE_CXX_EXTENSIONS OFF)
1313

1414
# Add the include directory as a target
1515
add_library(vfspp INTERFACE)
16+
add_library(vfspp::vfspp ALIAS vfspp)
1617

1718
target_include_directories(vfspp
1819
INTERFACE
@@ -21,4 +22,8 @@ target_include_directories(vfspp
2122
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/vendor/miniz-cpp>
2223
)
2324

24-
target_compile_features(vfspp INTERFACE cxx_std_17)
25+
target_compile_features(vfspp INTERFACE cxx_std_17)
26+
27+
if (BUILD_EXAMPLES)
28+
add_subdirectory(examples)
29+
endif()

examples/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ cmake_minimum_required(VERSION 3.10)
22

33
project(vfsppexample)
44

5-
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/.. vfspp_build)
5+
#add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/.. vfspp_build)
66

77
add_executable(vfsppexample example.cpp)
88

99
add_compile_definitions(VFSPP_ENABLE_MULTITHREADING)
1010

11-
target_link_libraries(vfsppexample PRIVATE vfspp)
11+
target_link_libraries(vfsppexample PRIVATE vfspp::vfspp)
1212
target_compile_features(vfsppexample PRIVATE cxx_std_17)
1313

1414
# Specify the output directory

0 commit comments

Comments
 (0)