1 cmake_minimum_required(VERSION 2.6)
4 set(PACKAGE_VERSION "0.8.4")
5 set(top_srcdir "${CMAKE_CURRENT_SOURCE_DIR}")
8 # User's settings - C Flags
15 set(CMAKE_C_FLAGS "-O3")
16 # Debug # valgrind --show-reachable=yes --leak-check=full -v exe
18 set(CMAKE_C_FLAGS "-O0 -g3")
21 # User's settings - General C Flags
22 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -std=c99 -pedantic")
28 configure_file("doc/Doxyfile.in" "Doxyfile")
31 ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
32 WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
33 COMMENT "Generating API documentation with Doxygen" VERBATIM
36 message (STATUS "Doxygen not found :( API documentation can not be built")
40 find_program(texi2pdf_exe texi2pdf)
44 ${texi2pdf_exe} ${CMAKE_CURRENT_SOURCE_DIR}/doc/openscop.texi --output=${CMAKE_CURRENT_BINARY_DIR}/openscop.pdf
45 WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
46 COMMENT "Generating documentation (pdf) (with texi2pdf)" VERBATIM
49 message (STATUS "texi2pdf not found :( Documentation can not be built")
55 find_library(gmp_LIB gmp)
57 message (STATUS "Library gmp found =) ${gmp_LIB}")
58 add_definitions(-DOSL_GMP_IS_HERE)
60 message(STATUS "Library gmp not found :(")
63 # Include directories (to use #include <> instead of #include "")
66 configure_file("include/osl/scop.h.in" "include/osl/scop.h")
67 include_directories("${CMAKE_CURRENT_BINARY_DIR}/include")
69 set(osl_INCLUDE "./include")
70 message(STATUS "Include osl = ${osl_INCLUDE}")
71 include_directories("${osl_INCLUDE}")
76 message(STATUS "C compiler = ${CMAKE_C_COMPILER}")
78 message(STATUS "Mode Release")
80 message(STATUS "Mode Debug")
82 message(STATUS "C flags = ${CMAKE_C_FLAGS}")
101 target_link_libraries(osl ${gmp_LIB})
103 get_property(osl_lib_location TARGET osl PROPERTY LOCATION)
104 message(STATUS "Add osl library (shared) ${osl_lib_location}")
112 set_target_properties(osl_static PROPERTIES OUTPUT_NAME osl)
114 target_link_libraries(osl_static ${gmp_LIB})
116 get_property(osl_static_lib_location TARGET osl_static PROPERTY LOCATION)
117 message(STATUS "Add osl library (static) ${osl_static_lib_location}")
120 # Executables & tests
124 message(STATUS "---") # osl_test
127 message(STATUS "Add executable tests/${exe}")
128 add_executable(${exe} "tests/${exe}.c")
129 target_link_libraries(${exe} osl_static)
130 add_test(${exe} "${exe}")
132 message(STATUS "---")
137 install(TARGETS osl LIBRARY DESTINATION lib)
138 install(TARGETS osl_static ARCHIVE DESTINATION lib)
139 install(DIRECTORY include/ DESTINATION include FILES_MATCHING PATTERN "*.h")
140 install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/include/" DESTINATION include FILES_MATCHING PATTERN "*.h")
141 install(FILES osl-config.cmake DESTINATION lib/osl)
146 message(STATUS "You can execute:")
147 message(STATUS " make # To compile osl library")
148 message(STATUS " make test # To execute tests")
149 message(STATUS " make install # To install library, include and CMake module")
150 message(STATUS " # If you need root access:")
151 message(STATUS " # sudo make install")
152 message(STATUS " # su -c \"make install\"")
154 message(STATUS " make doxygen # To generate the Doxygen")
157 message(STATUS " make doc # To generate the documentation")
160 message(STATUS "---")