Skip to content

Commit 5e622d1

Browse files
authored
Merge pull request #7 from sdavtaker/master
Refactor on CMakeLists.txt and more .gitignore rules
2 parents c460352 + 00ae427 commit 5e622d1

File tree

2 files changed

+31
-3
lines changed

2 files changed

+31
-3
lines changed

.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,11 @@
11
.idea/
2+
3+
#cmake products
24
cmake-build-debug/
5+
Boost.Real.build/
6+
Boost.Real.xcodeproj/
7+
CMakeCache.txt
8+
CMakeFiles/
9+
CMakeScripts/
10+
CTestTestfile.cmake
11+
cmake_install.cmake

CMakeLists.txt

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,21 @@ project(Boost.Real)
33
set (Boost.Real 1)
44
set (Boost.Real 0)
55

6-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -pedantic -std=c++11")
6+
add_library(Boost.Real INTERFACE)
77

8-
include_directories(include)
8+
# Check for standard to use
9+
include(CheckCXXCompilerFlag)
10+
check_cxx_compiler_flag(-std=c++17 HAVE_FLAG_STD_CXX17)
11+
if(HAVE_FLAG_STD_CXX17)
12+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic --std=c++17")
13+
else()
14+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic --std=c++1z")
15+
endif()
16+
17+
#Detect Boost.Test framework
18+
find_package(Boost COMPONENTS unit_test_framework REQUIRED)
19+
20+
include_directories(include ${Boost_INCLUDE_DIRS})
921

1022
# Unit tests
1123
enable_testing()
@@ -14,4 +26,11 @@ foreach(testSrc ${TestSources})
1426
get_filename_component(testName ${testSrc} NAME_WE)
1527
add_executable(${testName} ${testSrc})
1628
add_test(${testName} ${testName})
17-
endforeach(testSrc)
29+
endforeach(testSrc)
30+
31+
#Library Headers
32+
add_executable(Boost.Real_headers include)
33+
set_target_properties(Boost.Real_headers PROPERTIES
34+
EXCLUDE_FROM_ALL TRUE
35+
EXCLUDE_FROM_DEFAULT_BUILD TRUE
36+
LINKER_LANGUAGE CXX)

0 commit comments

Comments
 (0)