Skip to content

Commit fbd175a

Browse files
committed
added version number and improved lib list
1 parent f2c7db5 commit fbd175a

File tree

4 files changed

+31
-10
lines changed

4 files changed

+31
-10
lines changed

CMakeLists.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,10 @@ project(cpp-particle-system)
33
set(CMAKE_CXX_STANDARD 17)
44

55
add_subdirectory(src)
6-
add_subdirectory(examples/sdl2)
6+
7+
option(BUILD_EXAMPLES "Build examples" ON)
8+
9+
if (BUILD_EXAMPLES)
10+
MESSAGE(STATUS "Building examples is enabled")
11+
add_subdirectory(examples)
12+
endif()

examples/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
add_subdirectory(sdl2)

examples/sdl2/CMakeLists.txt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
1-
cmake_minimum_required(VERSION 3.16.3)
21
project(sdl2-example)
32

43
add_executable(sdl2-example main.cpp DemoApplication.cpp DemoApplication.h ParticleObject.cpp ParticleObject.h)
54

65
if( WIN32 OR WIN64 )
76
find_package(SDL2 CONFIG REQUIRED)
87
find_package(sdl2-image CONFIG REQUIRED)
9-
target_link_libraries(sdl2-example PRIVATE SDL2::SDL2 SDL2::SDL2main SDL2::SDL2_image CppParticleSystem)
8+
target_link_libraries(sdl2-example PRIVATE SDL2::SDL2 SDL2::SDL2main SDL2::SDL2_image cpp-particle-system)
109
else()
1110
find_package(SDL2 REQUIRED)
1211
find_package(SDL2_image REQUIRED)
1312
include_directories(${SDL2_INCLUDE_DIR} ${SDL2_IMAGE_INCLUDE_DIR})
1413
include_directories(${SDL2_INCLUDE_DIRS} ${SDL2_IMAGE_INCLUDE_DIRS})
15-
target_link_libraries(sdl2-example ${SDL2_LIBRARIES} ${SDL2_IMAGE_LIBRARIES} CppParticleSystem)
14+
target_link_libraries(sdl2-example ${SDL2_LIBRARIES} ${SDL2_IMAGE_LIBRARIES} cpp-particle-system)
1615
endif()
1716

1817
#target_link_directories(sdl2-example PRIVATE CppParticleSystem/)

src/CMakeLists.txt

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,25 @@
1-
cmake_minimum_required(VERSION 3.16.3)
2-
project(CppParticleSystem)
1+
project(cpp-particle-system)
2+
set(PROJECT_VERSION 3.1)
33

4-
set(CppParticleSystem
5-
ParticleSystem.h
4+
set(sources
65
ParticleSystem.cpp
76
)
87

9-
add_library(CppParticleSystem STATIC ${CppParticleSystem})
10-
target_include_directories(CppParticleSystem PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}")
8+
set(public_headers
9+
ParticleSystem.h
10+
)
11+
12+
add_library(cpp-particle-system ${sources} ${public_headers})
13+
14+
set_target_properties(cpp-particle-system PROPERTIES
15+
PUBLIC_HEADER "${public_headers}"
16+
VERSION ${PROJECT_VERSION}
17+
)
18+
19+
target_include_directories(cpp-particle-system
20+
PUBLIC
21+
$<INSTALL_INTERFACE:include>
22+
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
23+
PRIVATE
24+
${CMAKE_CURRENT_SOURCE_DIR}
25+
)

0 commit comments

Comments
 (0)