diff options
author | iphydf <iphydf@users.noreply.github.com> | 2018-06-24 22:56:07 +0000 |
---|---|---|
committer | iphydf <iphydf@users.noreply.github.com> | 2018-07-01 08:35:44 +0000 |
commit | 1a54be06cd359257478b584611f34058d21fe723 (patch) | |
tree | db3d6ca2dfa2a87ae2efdac6e412c2b780a64009 /cmake | |
parent | 706fad1ce88c2104009a3835ee343ff9d8ec8b79 (diff) |
Simplify Travis CI builds.
Have one script per build. This means more duplication between the
scripts, but it's much easier to understand and to run locally.
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/AddCompilerFlag.cmake | 47 | ||||
-rw-r--r-- | cmake/CompileGTest.cmake | 3 |
2 files changed, 3 insertions, 47 deletions
diff --git a/cmake/AddCompilerFlag.cmake b/cmake/AddCompilerFlag.cmake deleted file mode 100644 index 6a4a3f56..00000000 --- a/cmake/AddCompilerFlag.cmake +++ /dev/null | |||
@@ -1,47 +0,0 @@ | |||
1 | include(CheckCCompilerFlag) | ||
2 | include(CheckCXXCompilerFlag) | ||
3 | |||
4 | function(add_cflag flag) | ||
5 | string(REGEX REPLACE "[^a-zA-Z0-9_]" "_" var ${flag}) | ||
6 | if(NOT DEFINED HAVE_C${var}) | ||
7 | message(STATUS "checking for C compiler flag: ${flag}") | ||
8 | endif() | ||
9 | set(CMAKE_REQUIRED_QUIET TRUE) | ||
10 | |||
11 | check_c_compiler_flag("${flag}" HAVE_C${var} QUIET) | ||
12 | if(HAVE_C${var}) | ||
13 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${flag}" PARENT_SCOPE) | ||
14 | endif() | ||
15 | endfunction() | ||
16 | |||
17 | function(add_cxxflag flag) | ||
18 | string(REGEX REPLACE "[^a-zA-Z0-9_]" "_" var ${flag}) | ||
19 | if(NOT DEFINED HAVE_CXX${var}) | ||
20 | message(STATUS "checking for C++ compiler flag: ${flag}") | ||
21 | endif() | ||
22 | set(CMAKE_REQUIRED_QUIET TRUE) | ||
23 | |||
24 | check_cxx_compiler_flag("${flag}" HAVE_CXX${var} QUIET) | ||
25 | if(HAVE_CXX${var}) | ||
26 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}" PARENT_SCOPE) | ||
27 | endif() | ||
28 | endfunction() | ||
29 | |||
30 | function(add_dllflag flag) | ||
31 | string(REGEX REPLACE "[^a-zA-Z0-9_]" "_" var ${flag}) | ||
32 | if(NOT DEFINED HAVE_LD${var}) | ||
33 | message(STATUS "checking for C++ compiler flag: ${flag}") | ||
34 | endif() | ||
35 | set(CMAKE_REQUIRED_QUIET TRUE) | ||
36 | |||
37 | check_c_compiler_flag("${flag}" HAVE_LD${var} QUIET) | ||
38 | if(HAVE_LD${var}) | ||
39 | set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${flag}" PARENT_SCOPE) | ||
40 | set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${flag}" PARENT_SCOPE) | ||
41 | endif() | ||
42 | endfunction() | ||
43 | |||
44 | macro(add_flag flag) | ||
45 | add_cflag(${flag}) | ||
46 | add_cxxflag(${flag}) | ||
47 | endmacro() | ||
diff --git a/cmake/CompileGTest.cmake b/cmake/CompileGTest.cmake index f9aa4506..9aa4712f 100644 --- a/cmake/CompileGTest.cmake +++ b/cmake/CompileGTest.cmake | |||
@@ -1,5 +1,8 @@ | |||
1 | # Find and compile the GTest library. | 1 | # Find and compile the GTest library. |
2 | 2 | ||
3 | include(CheckCXXCompilerFlag) | ||
4 | include(CheckIncludeFileCXX) | ||
5 | |||
3 | message(STATUS "Checking for gtest") | 6 | message(STATUS "Checking for gtest") |
4 | 7 | ||
5 | # Look for the sources. | 8 | # Look for the sources. |