Skip to content

Commit

Permalink
Update CMake file so it can be used with FetchContent in other projects
Browse files Browse the repository at this point in the history
  • Loading branch information
thisistherk committed Aug 1, 2021
1 parent 9255172 commit 86d7dc6
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,17 @@ CMAKE_MINIMUM_REQUIRED(VERSION 3.0)

PROJECT(fast_obj)

SET(CMAKE_CXX_STANDARD 11)
OPTION(FAST_OBJ_BUILD_TEST "Build test application" OFF)

ADD_EXECUTABLE(test test/test.cpp)
TARGET_INCLUDE_DIRECTORIES(test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
ADD_LIBRARY(fast_obj INTERFACE)
TARGET_INCLUDE_DIRECTORIES(fast_obj INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})

ADD_LIBRARY(fast_obj_lib STATIC fast_obj.c)
TARGET_INCLUDE_DIRECTORIES(fast_obj_lib PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})


IF(${FAST_OBJ_BUILD_TEST})
ADD_EXECUTABLE(fast_obj_test test/test.cpp)
TARGET_COMPILE_FEATURES(fast_obj_test PRIVATE cxx_std_11)
TARGET_LINK_LIBRARIES(fast_obj_test PRIVATE fast_obj_lib)
ENDIF()

0 comments on commit 86d7dc6

Please sign in to comment.