cmake_minimum_required(VERSION 3.0)

set(BASE_DIR ${CMAKE_CURRENT_SOURCE_DIR})

set(PROJECT_NAME nufx)
set(PROJECT_ROOT ${CMAKE_CURRENT_SOURCE_DIR})
project(${PROJECT_NAME})
#set (CMAKE_VERBOSE_MAKEFILE "1")


#set(ALL_DEFINES " " )

set (ALL_DEFINES "\
-DSTDC_HEADERS=1 -DHAVE_FDOPEN=1 -DHAVE_FTRUNCATE=1 -DHAVE_LOCALTIME_R=1 -DHAVE_MEMMOVE=1 \
-DHAVE_MKDIR=1 -DHAVE_MKSTEMP=1 -DHAVE_MKTIME=1 -DHAVE_SNPRINTF=1 -DHAVE_STRCASECMP=1 -DHAVE_STRNCASECMP=1 -DHAVE_STRERROR=1 \
-DHAVE_STRTOUL=1 -DHAVE_TIMELOCAL=1 -DHAVE_VSNPRINTF=1 -DHAVE_FCNTL_H=1 -DHAVE_MALLOC_H=1 -DHAVE_STDLIB_H=1 -DHAVE_SYS_STAT_H=1 \
-DHAVE_SYS_TIME_H=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_UNISTD_H=1 -DHAVE_UTIME_H=1 -DSPRINTF_RETURNS_INT=1 -DSNPRINTF_DECLARED=1 \
-DVSNPRINTF_DECLARED=1 -DENABLE_SQ=1 -DENABLE_LZW=1 -DENABLE_LZC=1 -DENABLE_DEFLATE=1 \
"
)

#message("${ALL_DEFINES}")

#set(ALL_DEFINES "&" )

set(DEBUG_OPT "-Wall -D_DEBUG -DDEBUG -O0 -g3 ${ALL_DEFINES} " )
#message("${DEBUG_OPT}")
set(RELEASE_OPT "-Wall -O3 ${ALL_DEFINES} " )
#message("${RELEASE_OPT}")

set(CMAKE_C_FLAGS "-Wall ${ALL_DEFINES}")
set(CMAKE_CXX_FLAGS "-Wall ${ALL_DEFINES}")

set(CMAKE_CXX_FLAGS_DEBUG "${DEBUG_OPT}")
set(CMAKE_CXX_FLAGS_RELEASE "${RELEASE_OPT}")
set(CMAKE_C_FLAGS_DEBUG "${DEBUG_OPT}")
set(CMAKE_C_FLAGS_RELEASE "${RELEASE_OPT}")

set(FIND_LIBRARY_USE_LIB64_PATHS TRUE)



set (SOURCE 
Archive.c 
ArchiveIO.c 
Bzip2.c 
Charset.c 
Compress.c
Crc16.c
Debug.c
Deferred.c 
Deflate.c 
Entry.c 
Expand.c 
FileIO.c 
Funnel.c
Lzc.c 
Lzw.c 
MiscStuff.c 
MiscUtils.c 
Record.c 
SourceSink.c
Squeeze.c 
Thread.c 
Value.c 
Version.c
) 

include_directories(BEFORE 
  ${PROJECT_ROOT}
)

add_library( ${PROJECT_NAME} SHARED ${SOURCE})
add_library( ${PROJECT_NAME}_static STATIC ${SOURCE})

target_link_libraries (
${PROJECT_NAME}
)



