author | koda |
Sat, 29 Jun 2013 02:42:15 +0200 | |
changeset 9301 | c5d1c8259ef4 |
parent 9255 | fd16cfa267aa |
child 9313 | 62032a4cd00b |
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) |
|
17 |
set(target_binary_install_dir "bin") |
|
18 |
set(target_library_install_dir "lib") |
|
19 |
||
20 |
string(SUBSTRING "${DATA_INSTALL_DIR}" 0 1 sharepath_start) |
|
21 |
if (NOT (${sharepath_start} MATCHES "/")) |
|
22 |
set(HEDGEWARS_DATADIR "${CMAKE_INSTALL_PREFIX}/${DATA_INSTALL_DIR}/") |
|
23 |
else() |
|
24 |
set(HEDGEWARS_DATADIR "${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 |
||
54 |
#paths where to find libraries (final slash not optional): |
|
55 |
# - the first is relative to the executable |
|
56 |
# - the second is the same directory of the executable (so it runs in bin/) |
|
57 |
# - the third one is the full path of the system dir |
|
58 |
#source http://www.cmake.org/pipermail/cmake/2008-January/019290.html |
|
59 |
set(CMAKE_INSTALL_RPATH "$ORIGIN/../${target_library_install_dir}/:$ORIGIN/:${CMAKE_INSTALL_PREFIX}/${target_library_install_dir}/") |
|
9255
fd16cfa267aa
ok you need to escape rpath for pscal scripts after all... (reverts r571e55b32da5)
koda
parents:
9232
diff
changeset
|
60 |
#\\\\ is just \\ which escapes '\' in the final script; same for $$ which escapes '$' in cmake |
fd16cfa267aa
ok you need to escape rpath for pscal scripts after all... (reverts r571e55b32da5)
koda
parents:
9232
diff
changeset
|
61 |
set(CMAKE_INSTALL_RPATH_ESCAPED "\\\\$$ORIGIN/../${target_library_install_dir}/:\\\\$$ORIGIN/:${CMAKE_INSTALL_PREFIX}/${target_library_install_dir}/") |
9198 | 62 |
|
63 |
if(UNIX AND NOT APPLE) |
|
9220 | 64 |
#make sure $ORIGIN is respected |
9226 | 65 |
add_linker_flag("-zorigin") |
9232 | 66 |
#apply RPATH settings to pascal executables |
9255
fd16cfa267aa
ok you need to escape rpath for pscal scripts after all... (reverts r571e55b32da5)
koda
parents:
9232
diff
changeset
|
67 |
add_flag_append(CMAKE_Pascal_FLAGS "-k-rpath -k'${CMAKE_INSTALL_RPATH_ESCAPED}'") |
9232 | 68 |
#until we link with external things there is no need to set rpath on haskell |
69 |
#list(APPEND haskell_flags "-optl" "-Wl,-rpath,'${CMAKE_INSTALL_RPATH_ESCAPED}'") |
|
9198 | 70 |
endif() |
71 |
||
72 |
#add the automatically determined parts of the RPATH |
|
73 |
#which point to directories outside the build tree to the install RPATH |
|
74 |
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH FALSE) |
|
75 |
||
76 |
||
9200 | 77 |
#install_name_tool magic for OS X |
78 |
set(CMAKE_INSTALL_NAME_DIR "@executable_path/../Frameworks") |
|
79 |