summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2019-05-25 17:37:23 +0200
committerStanislaw Halik <sthalik@misaki.pl>2019-05-25 17:37:23 +0200
commite1cf07c2e838bece3f1ad2de8d49a7ed0f2513e1 (patch)
tree001e3ecb2d8b92ccdad1ef7a17d12d63e891e5ca
parente274d7ed9173c615c4a3b6e3f2068f3caa99d392 (diff)
cmake: fix rpath on first generation
-rw-r--r--CMakeLists.txt9
-rw-r--r--cmake/opentrack-platform.cmake8
2 files changed, 9 insertions, 8 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5b1755f0..d60b8510 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -32,6 +32,15 @@ include(opentrack-policy NO_POLICY_SCOPE)
project(opentrack)
cmake_minimum_required(VERSION 3.13 FATAL_ERROR)
+# must be prior to CMakeDetermineCXXCompiler due to rpath
+if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT OR NOT CMAKE_INSTALL_PREFIX)
+ set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/install" CACHE PATH "" FORCE)
+endif()
+
+if(NOT CMAKE_BUILD_TYPE)
+ set(CMAKE_BUILD_TYPE "RELEASE" CACHE STRING "" FORCE)
+endif()
+
if(POLICY CMP0083)
cmake_policy(SET CMP0083 NEW)
include(CheckPIESupported)
diff --git a/cmake/opentrack-platform.cmake b/cmake/opentrack-platform.cmake
index b5c131a1..7a76276b 100644
--- a/cmake/opentrack-platform.cmake
+++ b/cmake/opentrack-platform.cmake
@@ -27,14 +27,6 @@ if(MSVC AND MSVC_VERSION LESS "1915" AND NOT ".${CMAKE_CXX_COMPILER_ID}" STREQUA
message(FATAL_ERROR "Visual Studio too old. Use Visual Studio 2017 or newer.")
endif()
-if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT OR NOT CMAKE_INSTALL_PREFIX)
- set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/install" CACHE PATH "" FORCE)
-endif()
-
-if(NOT CMAKE_BUILD_TYPE)
- set(CMAKE_BUILD_TYPE "RELEASE" CACHE STRING "" FORCE)
-endif()
-
set(CMAKE_EXPORT_COMPILE_COMMANDS ON) # for clang
string(TOUPPER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE)