Skip to content

Commit de200eb

Browse files
a1batrosseagleivg
authored andcommitted
cmake: set skip rpath on build stage, add easy install wrapper
1 parent 1bf9d60 commit de200eb

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

CMakeLists.txt

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,54 @@ project(OpenXRay)
44
include(${PROJECT_SOURCE_DIR}/cmake/utils.cmake)
55

66
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
7+
set(CMAKE_SKIP_BUILD_RPATH TRUE)
8+
if(NOT WIN32)
9+
set(CMAKE_INSTALL_PREFIX "") # Skip all *nix-style installing for a while. Use DESTDIR
10+
endif()
11+
712
include(cotire)
813

14+
function(xr_install tgt)
15+
if(NOT MSVC)
16+
install(TARGETS ${tgt} DESTINATION "."
17+
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
18+
GROUP_READ GROUP_EXECUTE
19+
WORLD_READ WORLD_EXECUTE) # chmod 755
20+
else()
21+
install(TARGETS ${tgt}
22+
CONFIGURATIONS Debug
23+
RUNTIME DESTINATION Debug/
24+
LIBRARY DESTINATION Debug/)
25+
install(FILES $<TARGET_PDB_FILE:${tgt}>
26+
CONFIGURATIONS Debug
27+
DESTINATION Debug/ )
28+
install(TARGETS ${tgt}
29+
CONFIGURATIONS Release
30+
RUNTIME DESTINATION Release/
31+
LIBRARY DESTINATION Release/)
32+
endif()
33+
endfunction()
34+
35+
# Use only if install defined outside target directory(like luabind, for example)
36+
function(xr_install_file tgt)
37+
if(NOT MSVC)
38+
install(FILES $<TARGET_FILE:${tgt}> DESTINATION "."
39+
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
40+
GROUP_READ GROUP_EXECUTE
41+
WORLD_READ WORLD_EXECUTE) # chmod 755
42+
else()
43+
install($<TARGET_FILE:${tgt}>
44+
CONFIGURATIONS Debug
45+
RUNTIME DESTINATION Debug/)
46+
install(FILES $<TARGET_PDB_FILE:${tgt}>
47+
CONFIGURATIONS Debug
48+
DESTINATION Debug/ )
49+
install($<TARGET_FILE:${tgt}>
50+
CONFIGURATIONS Release
51+
RUNTIME DESTINATION Release/)
52+
endif()
53+
endfunction()
54+
955
find_program(CCACHE_FOUND ccache)
1056
if(CCACHE_FOUND)
1157
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)

0 commit comments

Comments
 (0)