Skip to content

Commit ca5a1f7

Browse files
committed
examples - find_package must search in Frameworks subdirectory if APPLE.
1 parent 7f81ae1 commit ca5a1f7

File tree

1 file changed

+20
-5
lines changed

1 file changed

+20
-5
lines changed

examples/CMakeLists.txt

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,28 @@ project(lslexamples
55

66
include(GNUInstallDirs)
77

8-
find_package(LSL REQUIRED
9-
HINTS
10-
${LSL_INSTALL_ROOT}
11-
"${CMAKE_CURRENT_LIST_DIR}/../install" # GHA scripts default install directory
12-
"${CMAKE_CURRENT_LIST_DIR}/../cmake-build-release/install" # CLion default if using -DCMAKE_INSTALL_PREFIX=install
8+
set(LSL_SEARCH_PATHS
9+
${LSL_INSTALL_ROOT}
10+
"${CMAKE_CURRENT_LIST_DIR}/../install" # GHA scripts default install directory
11+
"${CMAKE_CURRENT_LIST_DIR}/../cmake-build-release/install" # CLion default if using -DCMAKE_INSTALL_PREFIX=install
12+
)
13+
if(APPLE)
14+
# Also search in a Frameworks subdirectory for each path
15+
foreach(p IN LISTS LSL_SEARCH_PATHS)
16+
if(p)
17+
list(APPEND LSL_SEARCH_PATHS "${p}/Frameworks")
18+
endif()
19+
endforeach()
20+
else()
21+
# Add MSVC-specific paths if not on Apple
22+
list(APPEND LSL_SEARCH_PATHS
1323
"${CMAKE_CURRENT_LIST_DIR}/../cmake-build-release-visual-studio/install" # CLion default if using VS compiler
1424
"${CMAKE_CURRENT_LIST_DIR}/../out/build/x64-Release/install" # MSVC default if using -DCMAKE_INSTALL_PREFIX=install
25+
)
26+
endif()
27+
28+
find_package(LSL REQUIRED
29+
HINTS ${LSL_SEARCH_PATHS}
1530
PATH_SUFFIXES share/LSL
1631
)
1732
get_filename_component(LSL_PATH ${LSL_CONFIG} DIRECTORY)

0 commit comments

Comments
 (0)