find_package for HogMaker in parent scope to get target exported properly

This commit is contained in:
Louis Gombert 2024-10-27 20:16:17 +01:00
parent 73d2c5803c
commit 95fc3d2ce4
2 changed files with 13 additions and 12 deletions

View File

@ -275,7 +275,12 @@ endif()
add_subdirectory(Descent3) add_subdirectory(Descent3)
add_subdirectory(tools) if (CMAKE_CROSSCOMPILING)
find_package(HogMaker REQUIRED)
else()
add_subdirectory(tools)
endif()
add_subdirectory(netcon) add_subdirectory(netcon)
add_subdirectory(netgames) add_subdirectory(netgames)
add_subdirectory(scripts) add_subdirectory(scripts)

View File

@ -1,11 +1,7 @@
if(CMAKE_CROSSCOMPILING) add_executable(
find_package(HogMaker)
else()
add_executable(
HogMaker HogMaker
HogMaker/HogFormat.cpp HogMaker/HogFormat.cpp
HogMaker/HogMaker.cpp HogMaker/HogMaker.cpp
) )
target_include_directories(HogMaker PRIVATE ${PROJECT_BINARY_DIR}/lib) target_include_directories(HogMaker PRIVATE ${PROJECT_BINARY_DIR}/lib)
export(TARGETS HogMaker FILE "${CMAKE_BINARY_DIR}/HogMakerConfig.cmake") export(TARGETS HogMaker FILE "${CMAKE_BINARY_DIR}/HogMakerConfig.cmake")
endif()