# Add a postfix for debug library builds to avoid name clashes with release builds
if(WIN32)
  set(CMAKE_DEBUG_POSTFIX d)
endif()

if(${ENABLE_SHARED})
  # Create a shared (dynamic) library for the complex number class
  add_library(${CMAKE_PROJECT_NAME} SHARED)
  
  # add correct compiler flags so that we can correctly import/export symbols
  if (MSVC)
    target_compile_definitions(${CMAKE_PROJECT_NAME} PRIVATE COMPILEDLL)
  endif()
else()
  # Create a static library for the complex number class
  add_library(${CMAKE_PROJECT_NAME} STATIC)

  # add correct compiler flags so that we can correctly import/export symbols
  if (MSVC)
    target_compile_definitions(${CMAKE_PROJECT_NAME} PRIVATE COMPILELIB)
  endif()
endif()

target_include_directories(${CMAKE_PROJECT_NAME}
  PUBLIC
    $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
    $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
)