[CMake] Add UPNPC_NO_INSTALL option

This commit is contained in:
past-due 2019-04-17 10:27:29 -04:00 committed by GitHub
parent 41f5475080
commit aea0a6093d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 28 additions and 21 deletions

View File

@ -10,6 +10,7 @@ option (UPNPC_BUILD_SHARED "Build shared library" TRUE)
option (UPNPC_BUILD_TESTS "Build test executables" TRUE)
option (UPNPC_BUILD_SAMPLE "Build sample executables" TRUE)
option (NO_GETADDRINFO "Define NO_GETADDRINFO" FALSE)
option (UPNPC_NO_INSTALL "Disable installation" FALSE)
if (NOT UPNPC_BUILD_STATIC AND NOT UPNPC_BUILD_SHARED)
message (FATAL "Both shared and static libraries are disabled!")
@ -108,10 +109,12 @@ if (UPNPC_BUILD_STATIC)
target_include_directories(libminiupnpc-static INTERFACE ../${CMAKE_CURRENT_SOURCE_DIR})
target_compile_definitions(libminiupnpc-static PUBLIC MINIUPNP_STATICLIB)
if (NOT UPNPC_NO_INSTALL)
install (TARGETS libminiupnpc-static
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib${LIB_SUFFIX}
ARCHIVE DESTINATION lib${LIB_SUFFIX})
endif()
if (UPNPC_BUILD_SAMPLE)
add_executable (upnpc-static upnpc.c)
@ -133,10 +136,12 @@ if (UPNPC_BUILD_SHARED)
target_link_libraries(libminiupnpc-shared INTERFACE ws2_32 iphlpapi)
endif()
if (NOT UPNPC_NO_INSTALL)
install (TARGETS libminiupnpc-shared
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib${LIB_SUFFIX}
ARCHIVE DESTINATION lib${LIB_SUFFIX})
endif()
if (UPNPC_BUILD_SAMPLE)
add_executable (upnpc-shared upnpc.c)
@ -177,6 +182,7 @@ if (UPNPC_BUILD_TESTS)
# set (UPNPC_INSTALL_TARGETS ${UPNPC_INSTALL_TARGETS} testminixml minixmlvalid testupnpreplyparse testigddescparse testminiwget)
endif ()
if (NOT UPNPC_NO_INSTALL)
install (FILES
miniupnpc.h
miniwget.h
@ -190,5 +196,6 @@ install (FILES
miniupnpc_declspec.h
DESTINATION include/miniupnpc
)
endif()
# vim: ts=2:sw=2