IF(NOT HAVE_DIRENT_H)
  SET( DIRENT_C dirent.c )
ENDIF(NOT HAVE_DIRENT_H)

SET( CHEADERS_CORE_PUBLIC ${CHEADERS_CORE_PUBLIC} PARENT_SCOPE )
SET( CHEADERS_CORE_PUBLIC
	../include/${PACKAGE_NAME}_core.h
	../include/${PACKAGE_NAME}_definitions.h
	../include/${PACKAGE_NAME}_types.h
        "${CMAKE_BINARY_DIR}/src/include/oyranos_version.h"
   )
SET( CHEADERS_CORE
	${CHEADERS_CORE_PUBLIC}
   )

SET( CFILES_CORE_PUBLIC
	${PACKAGE_NAME}_core.c
	${PACKAGE_NAME}_debug.c
	${PACKAGE_NAME}_i18n.c
   )
SET( CFILES_CORE_PUBLIC ${CFILES_CORE_PUBLIC} PARENT_SCOPE )
SET( CFILES_CORE
	${CFILES_CORE_PUBLIC}
	${PACKAGE_NAME}_helper.c
	${PACKAGE_NAME}_io_core.c
	${PACKAGE_NAME}_misc.c
	${PACKAGE_NAME}_sentinel_core.c
	${PACKAGE_NAME}_string.c
        ${DIRENT_C}
	md5.c
	lookup3.c
   )

SET( SOURCES ${CFILES_CORE} ${CHEADERS_CORE} )

SET( CMAKE_C_FLAGS "${CMAKE_C_FLAGS_CORE}" )
SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS_CORE}" )

ADD_LIBRARY( ${PROJECT_NAME}Core SHARED ${SOURCES} )
TARGET_LINK_LIBRARIES ( ${PROJECT_NAME}Core ${EXTRA_LIBS_CORE} )
ADD_LIBRARY( oyranos_core-static STATIC ${SOURCES})
TARGET_LINK_LIBRARIES ( oyranos_core-static ${EXTRA_LIBS_CORE} )

# OS X Framework
SET_TARGET_PROPERTIES( ${PROJECT_NAME}Core PROPERTIES
  FRAMEWORK TRUE
  FRAMEWORK_VERSION ${OYRANOS_VERSION}
  PRIVATE_HEADER ""
  PUBLIC_HEADER "${CHEADERS_CORE_PUBLIC}"
  RESOURCE ""
#  INSTALL_NAME_DIR "@executable_path/../../../../${FRAMEWORK_DIR}"
#  DEBUG_POSTFIX -d
)

INSTALL( TARGETS ${PROJECT_NAME}Core oyranos_core-static
         RUNTIME DESTINATION bin
         FRAMEWORK DESTINATION ${FRAMEWORK_DIR}
         LIBRARY DESTINATION ${LIB_DIR}
         ARCHIVE DESTINATION lib${LIB_SUFFIX}
         PUBLIC_HEADER DESTINATION include/${PACKAGE_NAME}
         RESOURCE DESTINATION ${FRAMEWORK_DIR}
       )

IF( USE_GETTEXT )
  MESSAGE( "-- OY_LINGUAS: ${OY_LINGUAS}" )
  IF(APPLE)
    FOREACH( oy_lang ${OY_LINGUAS} )
      INSTALL( FILES "${CMAKE_BINARY_DIR}/src/${oy_lang}.gmo"
               DESTINATION "${CMAKE_INSTALL_PREFIX}/${FRAMEWORK_DIR}/${PROJECT_NAME}Core.framework/Resources/locale/${oy_lang}/LC_MESSAGES"
               RENAME oyranos.mo )
    ENDFOREACH( oy_lang )
  ENDIF(APPLE)
ENDIF( USE_GETTEXT )
