Skip to content

Commit

Permalink
[cmake] Use default build rpath
Browse files Browse the repository at this point in the history
nekotools boot will already use neko from the build directory as long as
CMAKE_SKIP_BUILD_RPATH is false

No need to set LD_LIBRARY_PATH either, as rpath is set already.
  • Loading branch information
tobil4sk committed Mar 30, 2023
1 parent e97453d commit f633867
Showing 1 changed file with 3 additions and 20 deletions.
23 changes: 3 additions & 20 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -164,13 +164,12 @@ endforeach()
include(ExternalProject)


# CMAKE_BUILD_WITH_INSTALL_RPATH should be set to true.
# CMAKE_SKIP_BUILD_RPATH should be set to false.
# It is because `nekotools boot` will use the neko in build dir during build.
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
set(CMAKE_SKIP_BUILD_RPATH FALSE)

if (RELOCATABLE)
# https://cmake.org/Wiki/CMake_RPATH_handling
set(CMAKE_SKIP_BUILD_RPATH FALSE)
set(CMAKE_SKIP_INSTALL_RPATH FALSE)
if(APPLE)
set(CMAKE_MACOSX_RPATH TRUE)
Expand Down Expand Up @@ -394,12 +393,9 @@ set_target_properties(libneko
if (CMAKE_HOST_WIN32)
set(set_neko_env set NEKOPATH=${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
set(neko_exec $<TARGET_FILE:nekovm>)
elseif(CMAKE_HOST_APPLE)
set(set_neko_env "")
set(neko_exec DYLD_FALLBACK_LIBRARY_PATH=${CMAKE_RUNTIME_OUTPUT_DIRECTORY} NEKOPATH=${CMAKE_RUNTIME_OUTPUT_DIRECTORY} $<TARGET_FILE:nekovm>)
else()
set(set_neko_env "")
set(neko_exec LD_LIBRARY_PATH=${CMAKE_RUNTIME_OUTPUT_DIRECTORY} NEKOPATH=${CMAKE_RUNTIME_OUTPUT_DIRECTORY} $<TARGET_FILE:nekovm>)
set(neko_exec NEKOPATH=${CMAKE_RUNTIME_OUTPUT_DIRECTORY} $<TARGET_FILE:nekovm>)
endif()

file(GLOB compilers_src
Expand Down Expand Up @@ -803,26 +799,13 @@ if (WITH_NEKOML)
COMMAND nekoml
WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
)

set_tests_properties(nekoml
PROPERTIES
ENVIRONMENT LD_LIBRARY_PATH=${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
)
endif()

add_test(NAME nekotools
COMMAND nekotools
WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
)

if (UNIX AND NOT APPLE)
set_tests_properties(-version test.n nekoc nekotools
PROPERTIES
ENVIRONMENT LD_LIBRARY_PATH=${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
)
endif()


#######################

# debian source packages
Expand Down

0 comments on commit f633867

Please sign in to comment.