summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2016-09-11 08:41:23 +0200
committerStanislaw Halik <sthalik@misaki.pl>2016-09-11 08:41:23 +0200
commitc51bbdb6565056f8cf45d8efe3298766e6fda286 (patch)
treefa64923075b45bf8f4219fa781c699e93b9b4c10
parent2805768229898fa3802ceb6ef5585c2c0b973759 (diff)
cmake/platform: fixes
- set cmake_compiler_is_gnu<lang> consistently for clang - don't allow using GNU C xor GNU CXX - set necessary common msvc flags - remove OPENTRACK_API define, we've forked hatire - remove tautologies in checks
-rw-r--r--cmake/opentrack-platform.cmake35
1 files changed, 23 insertions, 12 deletions
diff --git a/cmake/opentrack-platform.cmake b/cmake/opentrack-platform.cmake
index 567ba0cb..d5bc5356 100644
--- a/cmake/opentrack-platform.cmake
+++ b/cmake/opentrack-platform.cmake
@@ -1,3 +1,18 @@
+if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
+ set(CMAKE_COMPILER_IS_GNUCXX TRUE)
+ set(CMAKE_COMPILER_IS_CLANG TRUE)
+endif()
+
+if(CMAKE_C_COMPILER_ID STREQUAL "Clang")
+ set(CMAKE_COMPILER_IS_GNUCC TRUE)
+ set(CMAKE_COMPILER_IS_GNUC TRUE)
+ set(CMAKE_COMPILER_IS_CLANG TRUE)
+endif()
+
+if((NOT CMAKE_COMPILER_IS_GNUCXX) EQUAL (NOT (NOT CMAKE_COMPILER_IS_GNUCC)))
+ message(FATAL_ERROR "cannot use GNU C xor GNU C++")
+endif()
+
IF(CMAKE_SYSTEM_NAME STREQUAL "Linux")
set(LINUX TRUE)
endif()
@@ -5,10 +20,16 @@ endif()
if(MSVC)
add_definitions(-DNOMINMAX -D_CRT_SECURE_NO_WARNINGS)
add_definitions(-D_ITERATOR_DEBUG_LEVEL=0 -D_HAS_ITERATOR_DEBUGGING=0 -D_SECURE_SCL=0)
+ set(CMAKE_CXX_FLAGS " /std:c++14 -DNOMINMAX -D_CRT_SECURE_NO_WARNINGS ${CMAKE_CXX_FLAGS} ")
+ set(CMAKE_C_FLAGS " -DNOMINMAX -D_CRT_SECURE_NO_WARNINGS ${CMAKE_C_FLAGS} ")
+
+ foreach (i SHARED MODULE EXE)
+ set(CMAKE_${i}_LINKER_FLAGS " /DYNAMICBASE /NXCOMPAT ${CMAKE_${i}_LINKER_FLAGS} ")
+ endforeach()
endif()
if(WIN32)
- if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_GNUCC)
+ if(CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_RC_COMPILER_INIT i686-w64-mingw32-windres)
set(CMAKE_RC_COMPILE_OBJECT "<CMAKE_RC_COMPILER> --use-temp-file -O coff <DEFINES> -i <SOURCE> -o <OBJECT>")
endif()
@@ -32,16 +53,6 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON)
include_directories(${CMAKE_SOURCE_DIR})
-# note, hatire supports both ftnoir and opentrack
-# don't remove without being sure as hell -sh 20140922
-add_definitions(-DOPENTRACK_API)
-
-if(${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang")
- set(CMAKE_COMPILER_IS_GNUCC TRUE)
- set(CMAKE_COMPILER_IS_GNUCXX TRUE)
- set(CMAKE_COMPILER_IS_CLANG TRUE)
-endif()
-
if(APPLE)
set(CMAKE_MACOSX_RPATH OFF)
set(apple-frameworks "-stdlib=libc++ -framework Cocoa -framework CoreFoundation -lobjc -lz -framework Carbon")
@@ -52,7 +63,7 @@ if(APPLE)
set(CMAKE_CXX_FLAGS " -stdlib=libc++ ${CMAKE_CXX_FLAGS}")
endif()
-if(CMAKE_COMPILER_IS_GNUCXX OR APPLE)
+if(CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_CXX_FLAGS " -std=c++14 ${CMAKE_CXX_FLAGS} ")
endif()