Files
DUO-RDP/CMakeLists.txt

96 lines
3.6 KiB
CMake

cmake_minimum_required(VERSION 3.21)
project(DuoRdpNative VERSION 2.2.0 LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
if(MSVC)
add_compile_options(/W4 /permissive- /utf-8)
add_link_options(/INCREMENTAL:NO)
else()
add_compile_options(-Wall -Wextra -Wpedantic)
endif()
add_executable(DuoRdpAuthService
native/cpp/DuoRdpAuthService.cpp
)
target_link_libraries(DuoRdpAuthService PRIVATE advapi32 bcrypt crypt32 winhttp user32 netapi32)
if(MSVC)
target_compile_options(DuoRdpAuthService PRIVATE /MT)
else()
target_link_options(DuoRdpAuthService PRIVATE -static -static-libgcc -static-libstdc++ -municode)
endif()
add_executable(DuoRdpAdmin WIN32
native/cpp/DuoRdpAdmin.cpp
)
target_link_libraries(DuoRdpAdmin PRIVATE advapi32 bcrypt comctl32 credui gdi32 shell32)
if(MSVC)
target_compile_options(DuoRdpAdmin PRIVATE /MT)
else()
target_link_options(DuoRdpAdmin PRIVATE -static -static-libgcc -static-libstdc++ -municode)
endif()
add_executable(DuoRdpInstaller
native/cpp/DuoRdpInstaller.cpp
)
target_link_libraries(DuoRdpInstaller PRIVATE advapi32 shell32)
if(MSVC)
target_compile_options(DuoRdpInstaller PRIVATE /MT)
else()
target_link_options(DuoRdpInstaller PRIVATE -static -static-libgcc -static-libstdc++ -municode)
endif()
add_executable(DUOUnIstall
native/cpp/DuoRdpInstaller.cpp
)
target_compile_definitions(DUOUnIstall PRIVATE DUO_RDP_UNINSTALL_DEFAULT=1)
target_link_libraries(DUOUnIstall PRIVATE advapi32 shell32)
if(MSVC)
target_compile_options(DUOUnIstall PRIVATE /MT)
else()
target_link_options(DUOUnIstall PRIVATE -static -static-libgcc -static-libstdc++ -municode)
endif()
# Existing Credential Provider is native C++ too. The target keeps its ABI,
# CLSIDs and DLL filename; the C++ service above replaces only the former C# /
# Python broker chain behind its named-pipe contract.
add_library(DuoRdpCredentialProvider SHARED
native/cp/DuoRdpCredentialProvider/ClassFactory.cpp
native/cp/DuoRdpCredentialProvider/DuoCredential.cpp
native/cp/DuoRdpCredentialProvider/DuoCredentialFilter.cpp
native/cp/DuoRdpCredentialProvider/DuoCredentialProvider.cpp
native/cp/DuoRdpCredentialProvider/dllmain.cpp
native/cp/DuoRdpCredentialProvider/exports.cpp
native/cp/DuoRdpCredentialProvider/DuoRdpCredentialProvider.def
)
set_target_properties(DuoRdpCredentialProvider PROPERTIES PREFIX "" OUTPUT_NAME "DuoRdpCredentialProvider")
target_link_libraries(DuoRdpCredentialProvider PRIVATE ole32 credui secur32 shell32 shlwapi advapi32 netapi32 crypt32 uuid propsys)
if(MSVC)
target_compile_options(DuoRdpCredentialProvider PRIVATE /MT)
else()
# MinGW auto-exports every public C++ symbol by default. The CP DLL must
# expose only the four COM entry points declared in its .def file.
target_link_options(DuoRdpCredentialProvider PRIVATE -static -static-libgcc -static-libstdc++ -Wl,--exclude-all-symbols)
endif()
# `cmake --install <build> --prefix <release-dir>` creates an installer-ready
# layout: installer/recovery EXEs at root and every runtime dependency in
# `<release-dir>/payload`.
install(TARGETS DuoRdpInstaller DUOUnIstall
RUNTIME DESTINATION .
)
# The installer copies its recovery executable from the selected payload.
# Keep the root copy for standalone recovery and ship the same binary inside
# payload so a default `DuoRdpInstaller.exe --install` is self-contained.
install(TARGETS DUOUnIstall
RUNTIME DESTINATION payload
)
install(TARGETS DuoRdpAuthService DuoRdpAdmin DuoRdpCredentialProvider
RUNTIME DESTINATION payload
LIBRARY DESTINATION payload
)
install(FILES native/cpp/README.md DESTINATION .)