summaryrefslogtreecommitdiffhomepage
path: root/cmake
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2018-05-27 05:39:57 +0200
committerStanislaw Halik <sthalik@misaki.pl>2018-05-27 06:22:04 +0200
commitf01d36f932675b708e9ea3aeda95681abe499da4 (patch)
tree8f8d10aa749d1f334ac303b9bdb60f62fc1e2f10 /cmake
parentcb3c5aa8c85a132556e63f1fe9218993aac24460 (diff)
cmake: cleanup
Diffstat (limited to 'cmake')
-rw-r--r--cmake/opentrack-boilerplate.cmake14
-rw-r--r--cmake/opentrack-platform.cmake22
2 files changed, 22 insertions, 14 deletions
diff --git a/cmake/opentrack-boilerplate.cmake b/cmake/opentrack-boilerplate.cmake
index fff1a6c3..1ac6c6e9 100644
--- a/cmake/opentrack-boilerplate.cmake
+++ b/cmake/opentrack-boilerplate.cmake
@@ -73,15 +73,15 @@ function(otr_compat target)
# gives incorrect result
#get_property(linker-lang TARGET ${target} PROPERTY LINKER_LANGUAGE)
- set_property(TARGET ${target} APPEND_STRING PROPERTY COMPILE_FLAGS "-fvisibility=hidden ")
+ #set_property(TARGET ${target} APPEND_STRING PROPERTY COMPILE_FLAGS "-fvisibility=hidden ")
- if (NOT ".${${target}-cxx}" STREQUAL ".") # not a C only target
- set_property(TARGET ${target} APPEND_STRING PROPERTY COMPILE_FLAGS "-fuse-cxa-atexit ")
- endif()
+ #if (NOT ".${${target}-cxx}" STREQUAL ".") # not a C only target
+ # set_property(TARGET ${target} APPEND_STRING PROPERTY COMPILE_FLAGS "-fuse-cxa-atexit ")
+ #endif()
- if(NOT APPLE)
- set_property(TARGET ${target} APPEND_STRING PROPERTY LINK_FLAGS "-Wl,--as-needed ")
- endif()
+ #if(NOT APPLE)
+ # set_property(TARGET ${target} APPEND_STRING PROPERTY LINK_FLAGS "-Wl,--as-needed ")
+ #endif()
endif()
endfunction()
diff --git a/cmake/opentrack-platform.cmake b/cmake/opentrack-platform.cmake
index c5d1da93..f54e4112 100644
--- a/cmake/opentrack-platform.cmake
+++ b/cmake/opentrack-platform.cmake
@@ -43,7 +43,6 @@ 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()
@@ -112,6 +111,14 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON)
include_directories("${CMAKE_SOURCE_DIR}")
+if(CMAKE_COMPILER_IS_GNUCXX)
+ if (UNIX AND NOT APPLE)
+ set(_common "-fPIC -fvisibility=hidden")
+ set(CMAKE_C_FLAGS "${_common} ${CMAKE_C_FLAGS}")
+ set(CMAKE_CXX_FLAGS "${_common} -fuse-cxa-atexit ${CMAKE_CXX_FLAGS}")
+ endif()
+endif()
+
if(APPLE)
set(CMAKE_MACOSX_RPATH OFF)
set(apple-frameworks "-stdlib=libc++ -framework Cocoa -framework CoreFoundation -lobjc -lz -framework Carbon")
@@ -119,7 +126,7 @@ if(APPLE)
#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}")
+ set(CMAKE_CXX_FLAGS "-stdlib=libc++ ${CMAKE_CXX_FLAGS}")
endif()
#if(NOT MSVC)
@@ -136,12 +143,13 @@ endforeach()
set_property(GLOBAL PROPERTY USE_FOLDERS OFF)
+# this hack fixed mingw-w64. is it necessary anymore? -sh 20180527
# nix -rdynamic passed from Linux-GNU.cmake
-if(CMAKE_COMPILER_IS_GNUCXX)
- set(__LINUX_COMPILER_GNU 1)
- set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS)
- set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS)
-endif()
+#if(CMAKE_COMPILER_IS_GNUCXX)
+# set(__LINUX_COMPILER_GNU 1)
+# set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS)
+# set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS)
+#endif()
if(MINGW)
add_definitions(-DMINGW_HAS_SECURE_API)