-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from boryssmejda/cmake_support
Cmake support Co-authored-by: boryssmejda <borys.smejda@gmail.com>
- Loading branch information
1 parent
5fc4d92
commit 1d78898
Showing
2 changed files
with
22 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,4 +11,5 @@ | |
*.a | ||
bin | ||
scratch | ||
build/ | ||
__pycache__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,24 @@ | ||
cmake_minimum_required(VERSION 2.8) | ||
|
||
# This is all hastily thrown together, will improve | ||
cmake_minimum_required(VERSION 3.1) | ||
|
||
project(asserts) | ||
set(CMAKE_CXX_STANDARD 17) | ||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) | ||
add_library(assert SHARED src/assert.cpp) | ||
target_link_libraries(assert dbghelp) | ||
add_library(assert_static STATIC src/assert.cpp) | ||
target_link_libraries(assert_static dbghelp) | ||
|
||
#project(demo) | ||
#set(CMAKE_CXX_STANDARD 17) | ||
#include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) | ||
#add_executable(demo demo.cpp foo.cpp bar.cpp) | ||
#target_link_libraries(demo assert_static) | ||
#target_compile_options(demo PRIVATE "/DASSERT_FAIL=custom_fail" "/W4") | ||
add_library(asserts_library_warnings INTERFACE) | ||
target_compile_options(asserts_library_warnings | ||
INTERFACE -Wall -Wextra -Werror=return-type -Wshadow) | ||
|
||
add_library(assert src/assert.cpp) | ||
target_include_directories(assert PUBLIC | ||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/>) | ||
|
||
set_target_properties(assert | ||
PROPERTIES | ||
CXX_STANDARD 17 | ||
CXX_STANDARD_REQUIRED TRUE | ||
CXX_EXTENSIONS OFF) | ||
|
||
target_link_libraries(assert PRIVATE asserts_library_warnings) | ||
|
||
if (MSVC) | ||
target_link_libraries(assert PRIVATE dbghelp) | ||
endif () | ||
|