Skip to content

Commit dfeb581

Browse files
authored
CMake: Use library aliases instead of library names (#55)
This changeset makes it possible to compile hyprlang with a custom install prefix, which was not honored because of using "hyprutils" as a raw dependency, which means that CMake was adding "-lhyprutils" flag to the linker, but the linker didn't know the path in case a custom install prefix was used to compile hyprutils.
1 parent 5b175c9 commit dfeb581

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

CMakeLists.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,21 +56,22 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
5656
message(STATUS "Using clang++ to compile hyprlang")
5757
endif()
5858

59+
add_library(hypr::hyprlang ALIAS hyprlang)
5960
install(TARGETS hyprlang)
6061

6162
# tests
6263
add_custom_target(tests)
6364

6465
add_executable(hyprlang_test "tests/parse/main.cpp")
65-
target_link_libraries(hyprlang_test PRIVATE hyprlang hyprutils)
66+
target_link_libraries(hyprlang_test PRIVATE hypr::hyprlang)
6667
add_test(
6768
NAME "Parsing"
6869
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests
6970
COMMAND hyprlang_test "parse")
7071
add_dependencies(tests hyprlang_test)
7172

7273
add_executable(hyprlang_fuzz "tests/fuzz/main.cpp")
73-
target_link_libraries(hyprlang_fuzz PRIVATE hyprlang hyprutils)
74+
target_link_libraries(hyprlang_fuzz PRIVATE hypr::hyprlang)
7475
add_test(
7576
NAME "Fuzz"
7677
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests

0 commit comments

Comments
 (0)