stasis-aries-wal/CMakeLists.txt
2008-10-01 20:03:57 +00:00

64 lines
2.1 KiB
CMake

cmake_minimum_required(VERSION 2.4) # For all I know, 2.0 works too...
# Make cmake warning go away. They changed the default library search behavior.
# The new behavior seems preferable, though it shouldn't affect us either way.
if(COMMAND cmake_policy)
cmake_policy(SET CMP0003 NEW)
endif(COMMAND cmake_policy)
Project(Stasis)
SET(PACKAGE_VERSION 1)
SUBDIRS(src test utilities benchmarks examples)
SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
SET(FLEX_DIR ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
SET(BISON_DIR ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
# Main decisions
SET(BUILD_SHARED_LIBS ON)
#ENABLE_TESTING()
INCLUDE(CTest)
FIND_PACKAGE(FLEX)
FIND_PACKAGE(BISON)
# Look for include files
INCLUDE (CheckIncludeFiles)
FIND_LIBRARY(CHECK_LIBRARY NAMES check)
if(!CHECK_LIBRARY)
message("warning: libcheck not found; unit tests will not be built.")
endif(!CHECK_LIBRARY)
#CHECK_INCLUDE_FILES(check.h HAVE_LIBCHECK)
CHECK_INCLUDE_FILES(confuse.h HAVE_LIBCONFUSE)
MACRO(CREATE_CHECK NAME)
ADD_EXECUTABLE(${NAME} ${NAME}.c)
TARGET_LINK_LIBRARIES(${NAME} -lcheck ${COMMON_LIBRARIES})
ADD_TEST(${NAME} ${NAME})
ENDMACRO(CREATE_CHECK)
MACRO(CREATE_CHECK_OPT NAME OPT)
ADD_EXECUTABLE(${NAME} ${NAME}.c)
TARGET_LINK_LIBRARIES(${NAME} -lcheck ${COMMON_LIBRARIES})
ADD_TEST(${NAME} ${NAME} ${OPT})
ENDMACRO(CREATE_CHECK_OPT)
MACRO(CREATE_EXECUTABLE NAME)
ADD_EXECUTABLE(${NAME} ${NAME}.c)
TARGET_LINK_LIBRARIES(${NAME} ${COMMON_LIBRARIES})
ENDMACRO(CREATE_EXECUTABLE)
# Output the config.h file
#CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/src
/usr/include)
# set linker path for this and all subdirs
LINK_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/src/stasis ${CMAKE_CURRENT_BINARY_DIR}/src/libdfa)
SET(COMMON_LIBRARIES stasis rw m pthread)
SET(CMAKE_C_FLAGS "-g -Wall -pedantic -std=gnu99 -DPBL_COMPAT ${CMAKE_C_FLAGS}")
SET(CMAKE_CXX_FLAGS "-g -Wall -Wno-variadic-macros -Wno-long-long -pedantic -DPBL_COMPAT ${CMAKE_CXX_FLAGS}")