string(TOLOWER ${PROJECT_NAME} LOWER_PROJECT_NAME)

set(KIT3D ${LOWER_PROJECT_NAME}${KIT}3D)
set(KIT2D ${LOWER_PROJECT_NAME}${KIT}2D)

if(NOT ${PROJECT_NAME}_BUILD_SINGLE_LIBRARY)
  add_library(${KIT3D} ${kit_SRCS3D})
  set_target_properties(${KIT3D} PROPERTIES COMPILE_DEFINITIONS NDIM=3)
  add_dependencies(${KIT3D} IBTK-Build)

  if(${PROJECT_NAME}_BUILD_2D_LIBRARY)
    add_library(${KIT2D} ${kit_SRCS2D})
    set_target_properties(${KIT2D} PROPERTIES COMPILE_DEFINITIONS NDIM=2)
    add_dependencies(${KIT2D} IBTK-Build)
  endif()
else()
  add_library(${KIT3D} OBJECT ${kit_SRCS3D})
  if(BUILD_SHARED_LIBS)
    set_target_properties(${KIT3D} PROPERTIES COMPILE_FLAGS "-fPIC")
  endif()
  set_target_properties(${KIT3D} PROPERTIES COMPILE_DEFINITIONS NDIM=3)
  add_dependencies(${KIT3D} IBTK-Build)
  if(${PROJECT_NAME}_BUILD_2D_LIBRARY)
    add_library(${KIT2D} OBJECT ${kit_SRCS2D})
    if(BUILD_SHARED_LIBS)
      set_target_properties(${KIT2D} PROPERTIES COMPILE_FLAGS "-fPIC")
    endif()
    set_target_properties(${KIT2D} PROPERTIES COMPILE_DEFINITIONS NDIM=2)
    add_dependencies(${KIT2D} IBTK-Build)
  endif()
endif()
