summaryrefslogtreecommitdiffhomepage
path: root/cmake/opentrack-platform.cmake
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2015-10-30 07:37:41 +0100
committerStanislaw Halik <sthalik@misaki.pl>2015-10-30 08:39:32 +0100
commitaa066bdd4622d4f6824fee864f6be6806813f04d (patch)
tree3df328b8b364cba2373a85827191b259bd78d546 /cmake/opentrack-platform.cmake
parentd6a54431d178632a2bf466c9904f74abd143afe6 (diff)
move to subdirectory-based build system
Closes #224
Diffstat (limited to 'cmake/opentrack-platform.cmake')
-rw-r--r--cmake/opentrack-platform.cmake60
1 files changed, 60 insertions, 0 deletions
diff --git a/cmake/opentrack-platform.cmake b/cmake/opentrack-platform.cmake
new file mode 100644
index 00000000..aac3a2b8
--- /dev/null
+++ b/cmake/opentrack-platform.cmake
@@ -0,0 +1,60 @@
+IF(CMAKE_SYSTEM_NAME STREQUAL "Linux")
+ set(LINUX TRUE)
+endif()
+
+if(MSVC)
+ add_definitions(-DNOMINMAX -D_CRT_SECURE_NO_WARNINGS)
+endif()
+
+if(WIN32)
+ if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_GNUCC)
+ 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()
+ ENABLE_LANGUAGE(RC)
+endif(WIN32)
+
+set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
+set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
+set(CMAKE_SKIP_INSTALL_RPATH FALSE)
+set(CMAKE_SKIP_RPATH FALSE)
+set(CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_PREFIX})
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+set(CMAKE_AUTOMOC OFF)
+set(CMAKE_POSITION_INDEPENDENT_CODE ON)
+
+include_directories(${CMAKE_SOURCE_DIR})
+include_directories(${CMAKE_CURRENT_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)
+endif()
+
+if(CMAKE_COMPILER_IS_GNUCXX AND NOT APPLE)
+ if(MINGW)
+ set(version-script mingw)
+ else()
+ set(version-script posix)
+ endif()
+endif()
+
+if(APPLE)
+ set(CMAKE_MACOSX_RPATH OFF)
+ set(apple-frameworks "-stdlib=libc++ -framework Cocoa -framework CoreFoundation -lobjc -lz -framework Carbon")
+ set(CMAKE_SHARED_LINKER_FLAGS " ${apple-frameworks} ${CMAKE_SHARED_LINKER_FLAGS}")
+ #set(CMAKE_STATIC_LINKER_FLAGS " ${apple-frameworks} ${CMAKE_STATIC_LINKER_FLAGS}")
+ set(CMAKE_EXE_LINKER_FLAGS " ${apple-frameworks} ${CMAKE_EXE_LINKER_FLAGS}")
+ set(CMAKE_MODULE_LINKER_FLAGS " ${apple-frameworks} ${CMAKE_MODULE_LINKER_FLAGS}")
+ set(CMAKE_CXX_FLAGS " -stdlib=libc++ ${CMAKE_CXX_FLAGS}")
+endif()
+
+if(CMAKE_COMPILER_IS_GNUCXX OR APPLE)
+ set(CMAKE_CXX_FLAGS " -std=c++11 ${CMAKE_CXX_FLAGS} ")
+endif()
+
+set_property(GLOBAL PROPERTY USE_FOLDERS OFF)