Skip to content

Commit

Permalink
cmake: Set RPATH the cmake way
Browse files Browse the repository at this point in the history
  • Loading branch information
cryptomilk committed Mar 13, 2024
1 parent 9cf5d9f commit acec4e8
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,9 @@ if(MSVC)
# Force compiler to use UTF-8 for IPA constants
add_compile_options("$<$<C_COMPILER_ID:MSVC>:/utf-8>")
add_compile_options("$<$<CXX_COMPILER_ID:MSVC>:/utf-8>")

elseif(NOT APPLE)
# Linux flags
string(APPEND CMAKE_CXX_FLAGS " -Wall -Wextra -Wl,-rpath,'$ORIGIN'")
string(APPEND CMAKE_CXX_FLAGS " -Wall -Wextra")
string(APPEND CMAKE_C_FLAGS " -Wall -Wextra")
endif()

Expand Down Expand Up @@ -177,6 +176,15 @@ if(NOT WIN32)
set_property(TARGET piper_phonemize_exe PROPERTY OUTPUT_NAME piper_phonemize)
endif()

if (APPLE)
set_target_properties(piper_phonemize_exe PROPERTIES
MACOSX_RPATH TRUE)
elseif(NOT MSVC)
# Linux
set_target_properties(piper_phonemize_exe PROPERTIES
BUILD_RPATH_USE_ORIGIN TRUE)
endif()

target_compile_features(piper_phonemize_exe PUBLIC cxx_std_17)

target_include_directories(
Expand Down

0 comments on commit acec4e8

Please sign in to comment.