/simpletypesystem/trunk

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/simpletypesystem/trunk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
cmake_minimum_required (VERSION 2.8)
project(SuperSimpleTypeSystem)

option (DEBUG "Enable debug flags and macros in project" TRUE)

find_package (Threads REQUIRED)

if (CMAKE_USE_WIN32_THREADS_INIT)
  set (HAVE_MTHREAD ON)
  set (HAVE_PTHREAD OFF)
elseif (CMAKE_USE_PTHREADS_INIT)
  set (HAVE_PTHREAD ON)
  set (HAVE_MTHREAD OFF)
else ()
  set (HAVE_PTHREAD OFF)
  set (HAVE_MTHREAD OFF)
endif ()

set (SSTS_V_MAJOR 0)
set (SSTS_V_MINOR 0)
set (SSTS_V_PATCH 1)


if (WIN32)
  if (MINGW)
    message ("Compiling on Windows is undested.")
    # THIS IS UNTESTED.
    # On Wine (and, presumably ReactOS) (Using MingW) we need to pass -gdwarf-2
    # to ba able to get traceback information. This is not ideal.
    # On Windows we need to use cv2pdb (https://github.com/rainers/cv2pdb) to
    # provide debug information.
    # This can not be tested using cross-compile methods with MingW and Wine.
    set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11 -mthreads -Wall -gdwarf-2 -pthread")
    
    set (CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -std=c11 -mthreads -Wall -g -gdwarf-2")
    
    set (CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -std=c11 -mthreads -Wall -gdwarf-2 ")
  elseif (MSVC)
    message ("MSVC is not supported, Yet. Patches welcome!")
  endif ()
else ()
  add_definitions(-D_POSIX_C_SOURCE=199309L -D_GNU_SOURCE)
  # We need -rdynamic to get the traceback information on *nix.
  # This may not work on all non-windows targets. FIXME.
  set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pthread -std=c11  -Wall -rdynamic -fstack-protector-strong")
  
  set (CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -pthread -std=c11 -Wall -g -rdynamic -fstack-protector-strong")
  
  set (CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -pthread -std=c11 -Wall -rdynamic -fstack-protector-strong")
endif ()

# add a target to generate API documentation with Doxygen
find_package(Doxygen)
if(DOXYGEN_FOUND)
  configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY)
  add_custom_target(doc
    ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
    WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
    COMMENT "Generating API documentation with Doxygen" VERBATIM
  )
endif(DOXYGEN_FOUND)

add_subdirectory (libssts)
include_directories (${CMAKE_SOURCE_DIR}/libssts/)
add_subdirectory (tests)

add_library (ssts SHARED ${SSTS_SRC})
target_link_libraries (ssts ${CMAKE_THREAD_LIBS_INIT})
message (${CMAKE_THREAD_LIBS_INIT})


enable_testing()
add_test (test tests/ssts_test )
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} --extra-verbose)