cmake_minimum_required(VERSION 3.20)

project(ParavisInstallerCpp LANGUAGES CXX)

enable_language(RC)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

add_executable(ParavisInstaller WIN32
    src/main.cpp
    src/install.cpp
    src/disks.cpp
    src/util.cpp
    src/app.rc
)

# Keep the installer self-contained: no VC++ redistributable required.
set_property(TARGET ParavisInstaller PROPERTY MSVC_RUNTIME_LIBRARY
    "MultiThreaded$<$<CONFIG:Debug>:Debug>")

target_compile_definitions(ParavisInstaller PRIVATE
    UNICODE
    _UNICODE
    WIN32_LEAN_AND_MEAN
    NOMINMAX
)

target_compile_options(ParavisInstaller PRIVATE
    /utf-8
    /W4
    /permissive-
)

target_link_libraries(ParavisInstaller PRIVATE
    comctl32
    shell32
    user32
    gdi32
    advapi32
)

# The manifest is embedded through app.rc; do not let the linker add a second one.
target_link_options(ParavisInstaller PRIVATE /MANIFEST:NO)

set_target_properties(ParavisInstaller PROPERTIES
    OUTPUT_NAME "ParavisInstaller"
)
