Skip to content

Commit

Permalink
Rewrite cmake handling of libqes
Browse files Browse the repository at this point in the history
Removes all the libqes stuff from CMakeLists again, and add the new
option LIBQES_AS_SUBMODULE that disables install rules.
  • Loading branch information
kdm9 committed Feb 24, 2015
1 parent 8549007 commit 72e473e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 39 deletions.
41 changes: 5 additions & 36 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,37 +29,7 @@ MESSAGE(STATUS "${CMAKE_BUILD_TYPE} build of axe version: ${AXE_VERSION}")
## Find Packages and Headers ##
###############################

# all from CMakeLists.txt in libqes

# Header/symbols
INCLUDE(CheckSymbolExists)
INCLUDE(CheckFunctionExists)
INCLUDE(CheckLibraryExists)
INCLUDE(CheckIncludeFiles)

CHECK_SYMBOL_EXISTS(getline stdio.h GETLINE_FOUND)
CHECK_SYMBOL_EXISTS(strndup string.h STRNDUP_FOUND)
CHECK_INCLUDE_FILES(malloc.h MALLOC_H_FOUND)
IF(MALLOC_H_FOUND)
CHECK_SYMBOL_EXISTS(memalign malloc.h MEMALIGN_FOUND)
ELSE()
SET(MEMALIGN_FOUND False)
ENDIF()
CHECK_SYMBOL_EXISTS(getpagesize unistd.h GETPAGESIZE_FOUND)

FIND_PACKAGE(ZLIB 1.2.1 REQUIRED)
CHECK_LIBRARY_EXISTS(${ZLIB_LIBRARIES} gzbuffer "" GZBUFFER_FOUND)

# Set dependency flags appropriately
SET(LIBQES_DEPENDS_LIBS
${LIBQES_DEPENDS_LIBS}
${ZLIB_LIBRARIES})
SET(LIBQES_DEPENDS_INCLUDE_DIRS
${LIBQES_DEPENDS_INCLUDE_DIRS}
${ZLIB_INCLUDE_DIRS})
SET(LIBQES_DEPENDS_CFLAGS
${LIBQES_DEPENDS_CFLAGS}
${ZLIB_CFLAGS})
# Done by libqes' CML.txt

##########################
## Set Compiler Options ##
Expand All @@ -86,22 +56,21 @@ SET(AXEWRN "${AXEWRN} -Wold-style-definition -Waddress -Wmissing-noreturn ")
SET(AXEWRN "${AXEWRN} -Wstrict-overflow=1 -Wextra -Warray-bounds -Wall -D_FORTIFY_SOURCE=2")

SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${AXEWRN} ${LIBQES_DEPENDS_CFLAGS}")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${AXEWRN}")

INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/src
${CMAKE_SOURCE_DIR}/src/datrie
${CMAKE_SOURCE_DIR}/src/libqes/src
${CMAKE_SOURCE_DIR}/src/gsl
${LIBQES_DEPENDS_INCLUDE_DIRS})
${CMAKE_SOURCE_DIR}/src/gsl)
LINK_DIRECTORIES(${CMAKE_BINARY_DIR}/lib)

INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR})

CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/src/axe_config.h.in
${CMAKE_BINARY_DIR}/axe_config.h)
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/src/libqes/src/qes_config.h.in
${CMAKE_BINARY_DIR}/qes_config.h)

ADD_SUBDIRECTORY(docs)
ADD_SUBDIRECTORY(tests)
ADD_SUBDIRECTORY(src)
SET(LIBQES_AS_SUBMODULE True) # stop libqes installing itself
ADD_SUBDIRECTORY(src/libqes)
5 changes: 2 additions & 3 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
# Axe library (libaxe.a)
FILE(GLOB QES_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/libqes/src/*.c)
FILE(GLOB DATRIE_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/datrie/*.c)
FILE(GLOB GSL_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/gsl/*.c)
SET(AXELIB_SRCS ${DATRIE_SRCS} ${GSL_SRCS} ${QES_SRCS} axe.c)
SET(AXELIB_SRCS ${DATRIE_SRCS} ${GSL_SRCS} axe.c)

ADD_LIBRARY(axelib STATIC ${AXELIB_SRCS})
TARGET_LINK_LIBRARIES(axelib ${LIBQES_DEPENDS_LIBS})
TARGET_LINK_LIBRARIES(axelib qes_static)
SET_TARGET_PROPERTIES(axelib PROPERTIES OUTPUT_NAME axe)

# Executable
Expand Down

0 comments on commit 72e473e

Please sign in to comment.