project(unionfs-fuse)

cmake_minimum_required(VERSION 2.0)
INCLUDE (CheckIncludeFiles)

# Set a default build type for single-configuration
# CMake generators if no build type is set.
IF(NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE)
	SET(CMAKE_BUILD_TYPE RelWithDebInfo)
ENDIF(NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE)

# Select flags.
SET(CMAKE_C_FLAGS "-pipe -W -Wall -DFORTIFY_SOURCE=2")
SET(CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 -g")
SET(CMAKE_C_FLAGS_RELEASE "-O2")
SET(CMAKE_C_FLAGS_DEBUG "-O0 -g -DDEBUG")

add_definitions(-D_FILE_OFFSET_BITS=64 -DFUSE_USE_VERSION=26)

option(WITH_XATTR "Enable support for extended attributes" OFF)

# .h include files
if (WITH_XATTR)
	CHECK_INCLUDE_FILES("sys/xattr.h" HAVE_XATTR)
	IF (HAVE_XATTR)
		add_definitions(-DHAVE_XATTR)
	ENDIF(HAVE_XATTR)
ENDIF (WITH_XATTR)



add_subdirectory(src)
add_subdirectory(man)

project(unionfs-fuse C)

cmake_minimum_required(VERSION 2.0)
INCLUDE (CheckIncludeFiles)

# Set a default build type for single-configuration
# CMake generators if no build type is set.
IF(NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE)
	SET(CMAKE_BUILD_TYPE RelWithDebInfo)
ENDIF(NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE)

# Select flags.
SET(CMAKE_C_FLAGS "-pipe -W -Wall -DFORTIFY_SOURCE=2")
SET(CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 -g")
SET(CMAKE_C_FLAGS_RELEASE "-O2")
SET(CMAKE_C_FLAGS_DEBUG "-O0 -g -DDEBUG")

add_definitions(-D_FILE_OFFSET_BITS=64 -DFUSE_USE_VERSION=26)

option(WITH_XATTR "Enable support for extended attributes" OFF)

# .h include files
if (WITH_XATTR)
	CHECK_INCLUDE_FILES("sys/xattr.h" HAVE_XATTR)
	IF (HAVE_XATTR)
		add_definitions(-DHAVE_XATTR)
	ENDIF(HAVE_XATTR)
ENDIF (WITH_XATTR)



add_subdirectory(src)
add_subdirectory(man)

Disable check for C++ compiler
Disable check for C++ compiler

By default, CMake assumes that a project uses both the C and C++
languages, and unionfs-fuse's CMakeLists.txt doesn't explicit which
languages it uses. Therefore CMake checks for both a C compiler and a
C++ compiler, which prevents from building unionfs-fuse on platforms
that don't have a C++ compiler.

We adjust unionfs-fuse CMakeLists.txt to explicity state that we only
use the C language, so that the C++ compiler check is no longer
performed by Cmake.

Signed-off-by: Thomas Petazzoni <a5d87d2bd7c424ee5cbdb4e978635bf653d5a005@free-electrons.com>
