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)
|
|
4 |
|
|
5 |
#resource paths
|
|
6 |
if(UNIX AND NOT APPLE)
|
|
7 |
set(target_binary_install_dir "bin")
|
|
8 |
set(target_library_install_dir "lib")
|
|
9 |
|
|
10 |
string(SUBSTRING "${DATA_INSTALL_DIR}" 0 1 sharepath_start)
|
|
11 |
if (NOT (${sharepath_start} MATCHES "/"))
|
|
12 |
set(HEDGEWARS_DATADIR "${CMAKE_INSTALL_PREFIX}/${DATA_INSTALL_DIR}/")
|
|
13 |
else()
|
|
14 |
set(HEDGEWARS_DATADIR "${DATA_INSTALL_DIR}/")
|
|
15 |
endif()
|
|
16 |
set(HEDGEWARS_FULL_DATADIR "${HEDGEWARS_DATADIR}")
|
|
17 |
else()
|
|
18 |
set(target_binary_install_dir "./")
|
|
19 |
|
|
20 |
if(APPLE)
|
|
21 |
set(target_library_install_dir "../Frameworks/")
|
|
22 |
set(CMAKE_INSTALL_PREFIX "Hedgewars.app/Contents/MacOS/")
|
|
23 |
set(HEDGEWARS_DATADIR "../Resources/")
|
|
24 |
set(HEDGEWARS_FULL_DATADIR "/Applications/${CMAKE_INSTALL_PREFIX}/${HEDGEWARS_DATADIR}")
|
|
25 |
elseif(WIN32)
|
|
26 |
set(target_library_install_dir "./")
|
|
27 |
set(HEDGEWARS_DATADIR "./")
|
|
28 |
set(HEDGEWARS_FULL_DATADIR "${CMAKE_INSTALL_PREFIX}/")
|
|
29 |
link_directories("${EXECUTABLE_OUTPUT_PATH}" "${CMAKE_SOURCE_DIR}/misc/winutils/bin")
|
|
30 |
endif()
|
|
31 |
endif()
|
9198
|
32 |
|
|
33 |
|
|
34 |
#RPATH SETTINGS
|
|
35 |
#necessary for dynamic libraries on UNIX, ignored elsewhere
|
|
36 |
|
|
37 |
#use, i.e. don't skip the full RPATH for the build tree
|
|
38 |
set(CMAKE_SKIP_BUILD_RPATH FALSE)
|
|
39 |
set(CMAKE_SKIP_INSTALL_RPATH FALSE)
|
|
40 |
|
|
41 |
#it's safe to use our RPATH because it is relative
|
|
42 |
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
|
|
43 |
|
|
44 |
#paths where to find libraries (final slash not optional):
|
|
45 |
# - the first is relative to the executable
|
|
46 |
# - the second is the same directory of the executable (so it runs in bin/)
|
|
47 |
# - the third one is the full path of the system dir
|
|
48 |
#source http://www.cmake.org/pipermail/cmake/2008-January/019290.html
|
|
49 |
set(CMAKE_INSTALL_RPATH "$ORIGIN/../${target_library_install_dir}/:$ORIGIN/:${CMAKE_INSTALL_PREFIX}/${target_library_install_dir}/")
|
|
50 |
set(CMAKE_INSTALL_RPATH_ESCAPED "$$ORIGIN/../${target_library_install_dir}/:$$ORIGIN/:${CMAKE_INSTALL_PREFIX}/${target_library_install_dir}/")
|
|
51 |
|
|
52 |
if(UNIX AND NOT APPLE)
|
9220
|
53 |
#make sure $ORIGIN is respected
|
|
54 |
append_linker_flag("-zorigin")
|
|
55 |
#apply RPATH settings to pascal and haskell executables
|
|
56 |
list(APPEND pascal_flags "-k-rpath" "-k'${CMAKE_INSTALL_RPATH_ESCAPED}'")
|
|
57 |
list(APPEND haskell_flags "-optl" "-Wl,-rpath,'${CMAKE_INSTALL_RPATH_ESCAPED}'")
|
9198
|
58 |
endif()
|
|
59 |
|
|
60 |
#add the automatically determined parts of the RPATH
|
|
61 |
#which point to directories outside the build tree to the install RPATH
|
|
62 |
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH FALSE)
|
|
63 |
|
|
64 |
|
9200
|
65 |
#install_name_tool magic for OS X
|
|
66 |
set(CMAKE_INSTALL_NAME_DIR "@executable_path/../Frameworks")
|
|
67 |
|