
	# Checking the OS
if (${CMAKE_SYSTEM_NAME} MATCHES "^Linux$|^FreeBSD$|^SunOS$|^NetBSD$|^OpenBSD$|^kFreeBSD$|^DragonFly$")
	message(STATUS "OS detected: ${CMAKE_SYSTEM_NAME}")
else ()
	message(FATAL_ERROR "OS: ${CMAKE_SYSTEM_NAME} is not supported")
endif ()

set(LIBSA_ABI_VERSION 1) # Increase this number everytime the ABI is broken

if (NOT DEFINED HEADERS_INSTALLATION_DIR)
	set(HEADERS_INSTALLATION_DIR "${CMAKE_INSTALL_PREFIX}/include/libsysactivity/")
endif (NOT DEFINED HEADERS_INSTALLATION_DIR)

if (NOT DEFINED LIB_INSTALLATION_DIR)
	set(LIB_INSTALLATION_DIR "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}")
endif (NOT DEFINED LIB_INSTALLATION_DIR)

	# Common headers
add_subdirectory(common)

	# Forcing to include the right libsysactivity.h through command line so it can compile whatever file
	# from another operating system without any include conflict
if (${CMAKE_SYSTEM_NAME} STREQUAL "kFreeBSD")
	add_definitions(-include ${CMAKE_CURRENT_SOURCE_DIR}/FreeBSD/libsysactivity.h)
else ()
	add_definitions(-include ${CMAKE_CURRENT_SOURCE_DIR}/${CMAKE_SYSTEM_NAME}/libsysactivity.h)
endif ()

	# Specific code
include_directories(common/)
if (${CMAKE_SYSTEM_NAME} STREQUAL "kFreeBSD")
	add_subdirectory("FreeBSD")
else ()
	add_subdirectory(${CMAKE_SYSTEM_NAME})
endif ()
