Further WIP, got the tests to link against pthread (was broken due to pkg-config not specifying -pthread as -lpthread and cmake thus not recognizing it as a library)

This commit is contained in:
Martijn Otto 2018-02-24 17:45:15 +01:00
parent a2396fe15b
commit 2f96c59929
4 changed files with 10 additions and 15 deletions

View file

@ -48,16 +48,12 @@ CHECK_TYPE_SIZE(_Bool _BOOL)
# generate the configuration file # generate the configuration file
configure_file("${PROJECT_SOURCE_DIR}/config.h.cmake" "${PROJECT_BINARY_DIR}/config.h") configure_file("${PROJECT_SOURCE_DIR}/config.h.cmake" "${PROJECT_BINARY_DIR}/config.h")
include_directories(${PROJECT_SOURCE_DIR}/include ${PROJECT_SOURCE_DIR}/src ${PROJECT_SOURCE_DIR}/3rdparty ${PROJECT_BINARY_DIR}) include_directories(${PROJECT_SOURCE_DIR}/include ${PROJECT_SOURCE_DIR}/3rdparty ${PROJECT_BINARY_DIR})
# link_directories(${LINK_DIRECTORIES} /opt/local/lib)
find_package(PCRE REQUIRED) find_package(PCRE REQUIRED)
# find_package(Judy REQUIRED)
# set(LIBS ${LIBS} ${PCRE_LIBRARIES} ${Judy_LIBRARIES} r3) set(LIBS ${PCRE_LIBRARIES} r3)
set(LIBS ${LIBS} ${PCRE_LIBRARIES} r3)
# set (CMAKE_CXX_FLAGS "-std=c++0x -arch x86_64 -stdlib=libc++ -g3 -Wall -O0")
enable_testing() enable_testing()
add_subdirectory(3rdparty) add_subdirectory(3rdparty)

View file

@ -1,9 +1,8 @@
include_directories("${PROJECT_SOURCE_DIR}/include ${PROJECT_SOURCE_DIR}/src ${PROJECT_SOURCE_DIR}/3rdparty ${PROJECT_SOURCE_DIR}") include_directories("${PROJECT_SOURCE_DIR}/include ${PROJECT_SOURCE_DIR}/3rdparty ${PROJECT_SOURCE_DIR}")
# install(TARGETS swiftnav-static DESTINATION lib${LIB_SUFFIX}) set(SOURCES node.c edge.c str.c token.c match_entry.c slug.c memory.c)
find_package(PCRE REQUIRED) set(LIBS ${LIBS} ${PCRE_LIBRARIES})
set(libr3_SRCS node.c edge.c list.c slug.c str.c token.c match_entry.c memory.c)
set(LIBS ${LIBS} ${PCRE_LIBRARIES} r3)
add_library(r3 STATIC ${libr3_SRCS}) add_library(r3 STATIC ${SOURCES})
target_link_libraries(r3 lib3rdparty pcre)
install(TARGETS r3 DESTINATION lib)
# install(FILES ${libswiftnav_HEADERS} DESTINATION include/libswiftnav) # install(FILES ${libswiftnav_HEADERS} DESTINATION include/libswiftnav)

View file

@ -12,7 +12,7 @@ else (NOT CHECK_FOUND)
include_directories(${CHECK_INCLUDE_DIRS}) include_directories(${CHECK_INCLUDE_DIRS})
# include_directories("${PROJECT_SOURCE_DIR}/include/r2") # include_directories("${PROJECT_SOURCE_DIR}/include/r2")
add_executable(check_tree check_tree.c) add_executable(check_tree check_tree.c)
target_link_libraries(check_tree ${TEST_LIBS}) target_link_libraries(check_tree ${TEST_LIBS} ${CHECK_LDFLAGS_OTHER})
add_custom_command( add_custom_command(
TARGET check_tree POST_BUILD TARGET check_tree POST_BUILD

View file

@ -7,7 +7,7 @@
#include "r3_slug.h" #include "r3_slug.h"
#include "zmalloc.h" #include "zmalloc.h"
#include "bench.h" #include "bench.h"
#include "r3_debug.h" #include "../src/r3_debug.h"
#define SAFE_FREE(ptr) if(ptr) free(ptr); #define SAFE_FREE(ptr) if(ptr) free(ptr);