Skip to content

Commit

Permalink
CMake: Use library aliases instead of library names (#55)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
kobalicek authored Sep 10, 2024
1 parent 5b175c9 commit dfeb581
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,21 +56,22 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
message(STATUS "Using clang++ to compile hyprlang")
endif()

add_library(hypr::hyprlang ALIAS hyprlang)
install(TARGETS hyprlang)

# tests
add_custom_target(tests)

add_executable(hyprlang_test "tests/parse/main.cpp")
target_link_libraries(hyprlang_test PRIVATE hyprlang hyprutils)
target_link_libraries(hyprlang_test PRIVATE hypr::hyprlang)
add_test(
NAME "Parsing"
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests
COMMAND hyprlang_test "parse")
add_dependencies(tests hyprlang_test)

add_executable(hyprlang_fuzz "tests/fuzz/main.cpp")
target_link_libraries(hyprlang_fuzz PRIVATE hyprlang hyprutils)
target_link_libraries(hyprlang_fuzz PRIVATE hypr::hyprlang)
add_test(
NAME "Fuzz"
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests
Expand Down

0 comments on commit dfeb581

Please sign in to comment.