summaryrefslogtreecommitdiff
path: root/cmake/PlatformConfig.cmake
blob: f2f5252f244f56259d3629ee4fcb25e58ed3fcb6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# cmake/PlatformConfig.cmake
#
# Set platform-specific compile definitions and helper variables

function(configure_platform target)
    if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
        target_compile_definitions(${target} PRIVATE BOLTDBG_PLATFORM_LINUX=1)
        message(STATUS "Configuring for Linux")
    elseif (CMAKE_SYSTEM_NAME STREQUAL "Darwin")
        target_compile_definitions(${target} PRIVATE BOLTDBG_PLATFORM_MACOS=1)
        message(STATUS "Configuring for macOS")
    elseif (CMAKE_SYSTEM_NAME MATCHES "Windows")
        target_compile_definitions(${target} PRIVATE BOLTDBG_PLATFORM_WINDOWS=1)
        message(STATUS "Configuring for Windows")
    else()
        target_compile_definitions(${target} PRIVATE BOLTDBG_PLATFORM_UNKNOWN=1)
        message(WARNING "Unknown platform: ${CMAKE_SYSTEM_NAME}")
    endif()

    # Example: helper macro for visibility
    if (MSVC)
        target_compile_definitions(${target} PRIVATE BOLTDBG_EXPORT=__declspec(dllexport))
    else()
        target_compile_definitions(${target} PRIVATE BOLTDBG_EXPORT=__attribute__((visibility(\"default\"))))
    endif()
endfunction()