view CMakeLists.txt @ 13:7886d2da8cc4

Trie working OK. Started on compact trie, ctrie.
author Eris Caffee <discordia@eldalin.com>
date Tue, 02 Oct 2012 10:13:07 -0500
parents d359966ed8de
children ef73b96fdcae
line source
1 cmake_minimum_required (VERSION 2.6 FATAL_ERROR)
2 #set (CMAKE_VERBOSE_MAKEFILE ON)
4 project (data_structures)
6 ################################################################################
7 # Ensure that we are not building in our source directories.
9 set (Build_Dir_OK "TRUE")
10 string (REGEX MATCH "^${CMAKE_SOURCE_DIR}" In_Sub_Dir ${CMAKE_BINARY_DIR})
11 if (In_Sub_Dir)
12 string (REGEX MATCH "^${CMAKE_SOURCE_DIR}/build" In_Build_Dir ${CMAKE_BINARY_DIR})
13 if (NOT In_Build_Dir)
14 set (Build_Dir_OK "FALSE")
15 endif ()
16 endif ()
18 if (NOT Build_Dir_OK)
19 message (FATAL_ERROR "You must run cmake from a directory that is not in your source tree, or that is in a special subdirectory of the tree whose name begins with 'build'.")
20 endif ()
23 if (CMAKE_BUILD_TYPE STREQUAL "")
24 # CMake defaults to leaving CMAKE_BUILD_TYPE empty. This messes up differentiation between debug and release builds.
25 set (CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel." FORCE)
26 endif ()
29 if (CMAKE_COMPILER_IS_GNUCXX)
30 add_definitions(-pedantic -Wall -std=gnu99)
31 endif ()
34 ################################################################################
36 option(Option_Profile_Program "Build for gprof profiling." OFF)
37 if (Option_Profile_Program)
38 add_definitions(-pg)
39 set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pg")
40 endif ()
43 ################################################################################
45 set (stack_SRCS src/stack.h src/stack.c)
46 add_executable (stack_test
47 src/stack_test.c
48 ${stack_SRCS}
49 )
51 set (ring_buffer_SRCS src/ring_buffer.h src/ring_buffer.c)
52 add_executable (ring_buffer_test
53 src/ring_buffer_test.c
54 ${ring_buffer_SRCS}
55 )
57 set (queue_SRCS src/queue.h src/queue.c)
58 add_executable (queue_test
59 src/queue_test.c
60 ${queue_SRCS}
61 )
63 set (dequeue_SRCS src/dequeue.h src/dequeue.c)
64 add_executable (dequeue_test
65 src/dequeue_test.c
66 ${dequeue_SRCS}
67 )
69 set (pqueue_SRCS src/pqueue.h src/pqueue.c)
70 add_executable (pqueue_test
71 src/pqueue_test.c
72 ${pqueue_SRCS}
73 )
75 set (list_SRCS src/list.h src/list.c)
76 add_executable (list_test
77 src/list_test.c
78 ${list_SRCS}
79 )
81 set (bst_SRCS src/bst.h src/bst.c)
82 add_executable (bst_test
83 src/bst_test.c
84 ${bst_SRCS}
85 )
87 set (rbtree_SRCS src/rbtree.h src/rbtree.c)
88 add_executable (rbtree_test
89 src/rbtree_test.c
90 ${rbtree_SRCS}
91 ${queue_SRCS}
92 )
93 target_link_libraries(rbtree_test m)
95 set (ost_SRCS src/ost.h src/ost.c)
96 add_executable (ost_test
97 src/ost_test.c
98 ${ost_SRCS}
99 )
101 set (trie_SRCS src/trie.h src/trie.c)
102 add_executable (trie_test
103 src/trie_test.c
104 ${trie_SRCS}
105 ${list_SRCS}
106 )