Skip to content

Commit 07f047f

Browse files
committedJul 11, 2021
cmake: Add fixes to generate Linux binaries
To build the game, do: mkdir build cd build cmake .. -DLUA_INTERPRETER_ENABLED=OFF make
1 parent 17cf5a4 commit 07f047f

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed
 

‎CMakeLists.txt

+19
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,20 @@ get_filename_component(EXECUTABLE_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME)
99

1010
project(${EXECUTABLE_NAME})
1111

12+
# Set installation settings
13+
# -------------------------
14+
15+
# When invoking cmake install, install binaries to build directory
16+
set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/install/" CACHE PATH
17+
"Default install path" FORCE)
18+
19+
# Set RPATH so that Linux looks for the libraries in the same folder. This needs
20+
# to go before any add_executable() or add_library()
21+
set(CMAKE_INSTALL_RPATH "$ORIGIN")
22+
23+
# Declare binary
24+
# --------------
25+
1226
add_executable(${EXECUTABLE_NAME})
1327

1428
# Link with libugba
@@ -65,3 +79,8 @@ target_include_directories(${EXECUTABLE_NAME} PRIVATE
6579
source
6680
built_assets
6781
)
82+
83+
# Define install targets
84+
# ----------------------
85+
86+
install(TARGETS ${EXECUTABLE_NAME} libugba DESTINATION .)

0 commit comments

Comments
 (0)
Please sign in to comment.