author | Wuzzy <Wuzzy2@mail.ru> |
Sat, 26 Oct 2019 21:59:42 +0200 | |
changeset 15488 | 70aba717485a |
parent 15486 | 58ce582ae87d |
permissions | -rw-r--r-- |
9190 | 1 |
#where to build libs and bins |
2 |
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin) |
|
3 |
set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin) |
|
9224 | 4 |
#these variables are for non-makefile generators |
5 |
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${EXECUTABLE_OUTPUT_PATH}) |
|
6 |
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${EXECUTABLE_OUTPUT_PATH}) |
|
7 |
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${EXECUTABLE_OUTPUT_PATH}) |
|
8 |
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${LIBRARY_OUTPUT_PATH}) |
|
9 |
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG ${LIBRARY_OUTPUT_PATH}) |
|
10 |
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE ${LIBRARY_OUTPUT_PATH}) |
|
11 |
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${LIBRARY_OUTPUT_PATH}) |
|
12 |
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE ${LIBRARY_OUTPUT_PATH}) |
|
13 |
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG ${LIBRARY_OUTPUT_PATH}) |
|
9190 | 14 |
|
15 |
#resource paths |
|
16 |
if(UNIX AND NOT APPLE) |
|
9862
14292fb8d094
BUILD: make binary/libdir destinations modifiable
hasufell <hasufell@gentoo.org>
parents:
9860
diff
changeset
|
17 |
set(target_binary_install_dir "bin" CACHE PATH "install dest for binaries") |
11324
ac6715709812
Add multiarch location to library (From Fedora)
Gianfranco Costamagna <costamagnagianfranco@yahoo.it>
parents:
10911
diff
changeset
|
18 |
set(target_library_install_dir "lib${LIB_SUFFIX}" CACHE PATH "install dest for libs") |
9190 | 19 |
|
20 |
string(SUBSTRING "${DATA_INSTALL_DIR}" 0 1 sharepath_start) |
|
10069 | 21 |
if(${sharepath_start} MATCHES "/") |
22 |
set(HEDGEWARS_DATADIR "${DATA_INSTALL_DIR}/") |
|
23 |
else() |
|
9190 | 24 |
set(HEDGEWARS_DATADIR "${CMAKE_INSTALL_PREFIX}/${DATA_INSTALL_DIR}/") |
25 |
endif() |
|
26 |
set(HEDGEWARS_FULL_DATADIR "${HEDGEWARS_DATADIR}") |
|
27 |
else() |
|
28 |
set(target_binary_install_dir "./") |
|
29 |
||
30 |
if(APPLE) |
|
31 |
set(target_library_install_dir "../Frameworks/") |
|
32 |
set(CMAKE_INSTALL_PREFIX "Hedgewars.app/Contents/MacOS/") |
|
33 |
set(HEDGEWARS_DATADIR "../Resources/") |
|
34 |
set(HEDGEWARS_FULL_DATADIR "/Applications/${CMAKE_INSTALL_PREFIX}/${HEDGEWARS_DATADIR}") |
|
35 |
elseif(WIN32) |
|
36 |
set(target_library_install_dir "./") |
|
37 |
set(HEDGEWARS_DATADIR "./") |
|
38 |
set(HEDGEWARS_FULL_DATADIR "${CMAKE_INSTALL_PREFIX}/") |
|
39 |
link_directories("${EXECUTABLE_OUTPUT_PATH}" "${CMAKE_SOURCE_DIR}/misc/winutils/bin") |
|
40 |
endif() |
|
41 |
endif() |
|
9198 | 42 |
|
43 |
||
44 |
#RPATH SETTINGS |
|
45 |
#necessary for dynamic libraries on UNIX, ignored elsewhere |
|
46 |
||
47 |
#use, i.e. don't skip the full RPATH for the build tree |
|
48 |
set(CMAKE_SKIP_BUILD_RPATH FALSE) |
|
49 |
set(CMAKE_SKIP_INSTALL_RPATH FALSE) |
|
50 |
||
51 |
#it's safe to use our RPATH because it is relative |
|
52 |
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) |
|
53 |
||
9339
14f5f3a1e2f7
some work on cmake_pascal files to better support flags we use, make engine compile as library again
koda
parents:
9313
diff
changeset
|
54 |
#add the automatically determined parts of the RPATH |
14f5f3a1e2f7
some work on cmake_pascal files to better support flags we use, make engine compile as library again
koda
parents:
9313
diff
changeset
|
55 |
#which point to directories outside the build tree to the install RPATH |
14f5f3a1e2f7
some work on cmake_pascal files to better support flags we use, make engine compile as library again
koda
parents:
9313
diff
changeset
|
56 |
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH FALSE) |
14f5f3a1e2f7
some work on cmake_pascal files to better support flags we use, make engine compile as library again
koda
parents:
9313
diff
changeset
|
57 |
|
9856 | 58 |
if(APPLE) |
9860
d419ff107e15
include paths before platform, move config code around
koda
parents:
9856
diff
changeset
|
59 |
#@rpath mangling |
9856 | 60 |
set(CMAKE_INSTALL_RPATH "@executable_path/../Frameworks") |
9860
d419ff107e15
include paths before platform, move config code around
koda
parents:
9856
diff
changeset
|
61 |
#install_name_tool for libraries |
15318
7e3bd4030aa5
Remove usage of macdeployqt in favor of CMake BundleUtilities. BundleUtilities properly finds all dependencies and adds them to the .app automatically. It also fixes rpath and install_name issues for any of the binaries or dependencies
raptor <buckyballreaction@gmail.com>
parents:
14285
diff
changeset
|
62 |
set(CMAKE_BUILD_WITH_INSTALL_NAME_DIR TRUE) |
9860
d419ff107e15
include paths before platform, move config code around
koda
parents:
9856
diff
changeset
|
63 |
set(CMAKE_INSTALL_NAME_DIR "@executable_path/../Frameworks") |
15486
58ce582ae87d
remove erroneous else conditions to make what is going on clearer, add a comment
nemo
parents:
15318
diff
changeset
|
64 |
# should this be a separate if block like so |
58ce582ae87d
remove erroneous else conditions to make what is going on clearer, add a comment
nemo
parents:
15318
diff
changeset
|
65 |
#if(NOT APPLE AND NOT (${CMAKE_INSTALL_PREFIX} MATCHES "/usr")) |
58ce582ae87d
remove erroneous else conditions to make what is going on clearer, add a comment
nemo
parents:
15318
diff
changeset
|
66 |
# there were some conditions here that implied not setting the RPATH if installed to /usr |
58ce582ae87d
remove erroneous else conditions to make what is going on clearer, add a comment
nemo
parents:
15318
diff
changeset
|
67 |
# but it was not being applied due to else not actually taking parameters (HT wuzzy) |
58ce582ae87d
remove erroneous else conditions to make what is going on clearer, add a comment
nemo
parents:
15318
diff
changeset
|
68 |
else() |
9856 | 69 |
#paths where to find libraries (final slash not optional): |
70 |
# - the first is relative to the executable |
|
71 |
# - the second is the same directory of the executable (so it runs in bin/) |
|
72 |
# - the third one is the full path of the system dir |
|
73 |
#source http://www.cmake.org/pipermail/cmake/2008-January/019290.html |
|
10911
5e3f42553ebc
Do not set rpath when binaries are installed in the standard search path
vittorio.giovara@gmail.com
parents:
10069
diff
changeset
|
74 |
#skip this if the install prefix is the standard one |
9856 | 75 |
set(CMAKE_INSTALL_RPATH "$ORIGIN/../${target_library_install_dir}/:$ORIGIN/:${CMAKE_INSTALL_PREFIX}/${target_library_install_dir}/") |
76 |
endif(APPLE) |