Merge pull request #720 from jimmy-park/fix-exe-target

cmake: don't add executable targets when `UPNPC_BUILD_SAMPLE` is `OFF`
This commit is contained in:
Thomas BERNARD 2024-03-20 00:11:39 +01:00 committed by GitHub
commit fe806bc652
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 12 additions and 18 deletions

View File

@ -139,19 +139,16 @@ if (UPNPC_BUILD_STATIC)
add_executable (upnpc-static src/upnpc.c)
target_link_libraries (upnpc-static PRIVATE libminiupnpc-static)
target_include_directories(upnpc-static PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
add_executable (upnp-listdevices-static src/listdevices.c)
target_link_libraries (upnp-listdevices-static PRIVATE libminiupnpc-static)
target_include_directories(upnp-listdevices-static PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
if (NOT UPNPC_NO_INSTALL)
install (TARGETS upnpc-static
install (TARGETS upnpc-static upnp-listdevices-static
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
endif()
endif ()
add_executable (upnp-listdevices-static src/listdevices.c)
target_link_libraries (upnp-listdevices-static PRIVATE libminiupnpc-static)
target_include_directories(upnp-listdevices-static PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
if (NOT UPNPC_NO_INSTALL)
install (TARGETS upnp-listdevices-static
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
endif()
endif ()
if (UPNPC_BUILD_SHARED)
@ -188,19 +185,16 @@ if (UPNPC_BUILD_SHARED)
add_executable (upnpc-shared src/upnpc.c)
target_link_libraries (upnpc-shared PRIVATE libminiupnpc-shared)
target_include_directories(upnpc-shared PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
add_executable (upnp-listdevices-shared src/listdevices.c)
target_link_libraries (upnp-listdevices-shared PRIVATE libminiupnpc-shared)
target_include_directories(upnp-listdevices-shared PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
if (NOT UPNPC_NO_INSTALL)
install (TARGETS upnpc-shared
install (TARGETS upnpc-shared upnp-listdevices-shared
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
endif()
endif ()
add_executable (upnp-listdevices-shared src/listdevices.c)
target_link_libraries (upnp-listdevices-shared PRIVATE libminiupnpc-shared)
target_include_directories(upnp-listdevices-shared PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
if (NOT UPNPC_NO_INSTALL)
install (TARGETS upnp-listdevices-shared
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
endif()
endif ()
if (UPNPC_BUILD_TESTS)