-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CMakeLists.txt cleanup to enable compilation for different compilers …
…than gcc (disabled MathGls MGL_HAVE_TYPEOF MGL_HAVE_C99_COMPLEX)
- Loading branch information
Till Ehrengruber
committed
Mar 10, 2016
1 parent
173c37e
commit 4f70999
Showing
2 changed files
with
61 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# to use this Figure library : | ||
# find_package( FIGURE REQUIRED ) | ||
# include_directories( ${FIGURE_INCLUDE_DIR} ) | ||
# add_executable( exec_name exec_source.cpp ) | ||
# target_link_libraries( exec_name Figure ) | ||
|
||
cmake_minimum_required( VERSION 2.8 ) | ||
project( FigureClass ) | ||
|
||
# use c++11 | ||
if(CMAKE_VERSION VERSION_GREATER 3.1.0 OR CMAKE_VERSION VERSION_EQUAL 3.1.0) | ||
# use c++11 | ||
# only valid for new platforms | ||
set(CMAKE_CXX_STANDARD 11) | ||
else() | ||
if (${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang" OR ${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU") | ||
# for older cmake versions | ||
# (note, this CXX flag is only valid for clang and gcc, for MSVC it is not needed) | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") | ||
endif() | ||
endif() | ||
# obsulete since we disabled MGL_HAVE_C99_COMPLEX, MGL_HAVE_TYPEOF | ||
#add_definitions( -Wall -std=gnu++11 -fext-numeric-literals ) | ||
|
||
set( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/Modules/ ) | ||
|
||
# set all header files in variable HEADER_FILES | ||
set( HEADER_FILES src/figure.hpp | ||
src/FigureConfig.hpp | ||
src/MglLabel.hpp | ||
src/MglPlot.hpp | ||
src/MglStyle.hpp ) | ||
|
||
# find and include Eigen | ||
find_package( Eigen3 REQUIRED ) | ||
include_directories(${EIGEN3_INCLUDE_DIR}) | ||
|
||
# find and inlude MathGl | ||
find_package( MathGL2 2.0.0 REQUIRED ) | ||
# patch mgl2/config.h | ||
file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/mathgl_patched_headers/mgl2) | ||
file(READ ${MATHGL2_INCLUDE_DIRS}/mgl2/config.h MATHGL_PATCHED_CONFIG_H) | ||
STRING(REGEX REPLACE "#define MGL_HAVE_TYPEOF[ \t]+1" "#define MGL_HAVE_TYPEOF 0 // patched" | ||
MATHGL_PATCHED_CONFIG_H ${MATHGL_PATCHED_CONFIG_H}) | ||
STRING(REGEX REPLACE "#define MGL_HAVE_C99_COMPLEX[ \t]+1" "#define MGL_HAVE_C99_COMPLEX 0 // patched" | ||
MATHGL_PATCHED_CONFIG_H ${MATHGL_PATCHED_CONFIG_H}) | ||
|
||
file(WRITE ${PROJECT_BINARY_DIR}/mathgl_patched_headers/mgl2/config.h ${MATHGL_PATCHED_CONFIG_H} ) | ||
include_directories(${PROJECT_BINARY_DIR}/mathgl_patched_headers/) | ||
include_directories(${MATHGL2_INCLUDE_DIRS}) | ||
|
||
# build library | ||
add_library( Figure src/figure.cpp ) | ||
target_link_libraries( Figure ${MATHGL2_LIBRARIES} ) | ||
|
||
# install library and header files | ||
install( TARGETS Figure | ||
ARCHIVE DESTINATION lib | ||
LIBRARY DESTINATION lib ) | ||
install( FILES ${HEADER_FILES} | ||
DESTINATION include/figure ) |
This file was deleted.
Oops, something went wrong.