aboutsummaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorWohlstand <admin@wohlnet.ru>2019-09-23 12:33:43 +0300
committerWohlstand <admin@wohlnet.ru>2019-09-23 12:33:43 +0300
commit8749ddc3da9574c2406a7dfd2fd6a4639148beef (patch)
tree6a9c4efffeca6941d4a6e4f5ad76eb9eb81896ed /CMakeLists.txt
parent62a018a1338b807d325d44a512499cf31563ab26 (diff)
downloadlibADLMIDI-8749ddc3da9574c2406a7dfd2fd6a4639148beef.tar.gz
libADLMIDI-8749ddc3da9574c2406a7dfd2fd6a4639148beef.tar.bz2
libADLMIDI-8749ddc3da9574c2406a7dfd2fd6a4639148beef.zip
Set "-no-pie" to all executables built by GCC
Otherwise, this happens: https://stackoverflow.com/questions/46551213/gcc-7-2-compiles-shared-library-instead-of-executable
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt18
1 files changed, 12 insertions, 6 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3e3cd41..2da1a4b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -63,12 +63,6 @@ if(MSVC)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
endif()
-# -fPIC thing
-if(NOT WIN32 AND NOT ADLMIDI_DOS)
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
-endif()
-
if(OPENBSD_LOCALBASE)
message("OpenBSD Detected!")
include_directories(${OPENBSD_LOCALBASE}/include)
@@ -232,6 +226,12 @@ if(libADLMIDI_STATIC OR WITH_VLC_PLUGIN)
set_legacy_standard(ADLMIDI_static)
set_visibility_hidden(ADLMIDI_static)
handle_options(ADLMIDI_static)
+
+ # -fPIC thing
+ if(NOT WIN32 AND NOT ADLMIDI_DOS)
+ set_target_properties(ADLMIDI_static PROPERTIES COMPILE_FLAGS "-fPIC")
+ endif()
+
if(NOT libADLMIDI_STATIC)
set_target_properties(ADLMIDI_static PROPERTIES EXCLUDE_FROM_ALL TRUE)
endif()
@@ -255,6 +255,12 @@ if(libADLMIDI_SHARED)
if(OPENBSD_LOCALBASE)
set_property(TARGET ADLMIDI_shared APPEND_STRING PROPERTY LINK_FLAGS " -lc")
endif()
+
+ # -fPIC thing
+ if(NOT WIN32 AND NOT ADLMIDI_DOS)
+ set_target_properties(ADLMIDI_shared PROPERTIES COMPILE_FLAGS "-fPIC")
+ endif()
+
set_target_properties(ADLMIDI_shared PROPERTIES SOVERSION "1")
endif()