Skip to content

Commit

Permalink
add cmake support and .gitignore file
Browse files Browse the repository at this point in the history
  • Loading branch information
corporal9736 committed May 31, 2022
1 parent 1677374 commit 6d0a6e4
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.cache
build
.vscode
16 changes: 16 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
cmake_minimum_required(VERSION 3.10)
project(pico)

option(PICO_TEST "build test" OFF)
option(PICO_EXAMPLE "build example" OFF)

if(PICO_TEST)
add_subdirectory(test)
endif()

if(PICO_EXAMPLE)
add_subdirectory(example)
endif()

add_library(${PROJECT_NAME} INTERFACE)
target_include_directories(${PROJECT_NAME} INTERFACE ${CMAKE_SOURCE_DIR})
10 changes: 10 additions & 0 deletions example/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
cmake_minimum_required(VERSION 3.10)

add_executable(hasher hasher.cpp)
target_include_directories(hasher
PRIVATE $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}>
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}>)
add_executable(interactive_hasher interactive_hasher.cpp)
target_include_directories(interactive_hasher
PRIVATE $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}>
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}>)
13 changes: 13 additions & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
cmake_minimum_required(VERSION 3.10)

include(CTest)

add_executable(unittest)

target_sources(unittest PRIVATE test.cpp)

target_include_directories(unittest
PRIVATE $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}>
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}>)

add_test(NAME unittest COMMAND unittest)

0 comments on commit 6d0a6e4

Please sign in to comment.