Skip to content

Commit 54cc28f

Browse files
arrowdTheAssassin
authored andcommitted
CMake: properly look for the argp.h header file
1 parent c247c92 commit 54cc28f

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

CMakeLists.txt

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -81,15 +81,13 @@ pkg_check_modules(libgio REQUIRED gio-2.0 IMPORTED_TARGET)
8181
pkg_check_modules(libcurl REQUIRED libcurl IMPORTED_TARGET)
8282

8383
# Alpine Linux does not ship an argp.h as part of the standard compiler toolchain
84-
unset(ARGP_H_FOUND CACHE)
85-
include(CheckCSourceCompiles)
86-
check_c_source_compiles("
87-
#include <argp.h>
88-
int main() { return 0; }
89-
" ARGP_H_FOUND)
84+
# Non-Linux OSes like FreeBSD do not have this header too
85+
find_file(ARGP_H argp.h HINTS /usr/include /usr/local/include)
9086

91-
if(NOT ARGP_H_FOUND)
87+
if(NOT ARGP_H)
9288
message(FATAL_ERROR "argp.h not installed, if on Alpine Linux please apk add argp-standalone")
9389
endif()
9490

91+
get_filename_component(ARGP_INCLUDE_DIR "${ARGP_H}" DIRECTORY)
92+
9593
add_subdirectory(src)

src/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ target_compile_definitions(appimagetool
2828

2929
target_include_directories(appimagetool
3030
PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include/>
31+
$<BUILD_INTERFACE:${ARGP_INCLUDE_DIR}>
3132
INTERFACE $<INSTALL_INTERFACE:include/>
3233
)
3334

0 commit comments

Comments
 (0)