mraajs: Check for CMAKE version > 3.1 or use workaround
Older cmake versions don't support the CXX_STANDARD property. Remove doubled CMAKE_CXX_FLAGS in mraajs COMPILE_FLAGS Closes #411 Signed-off-by: Eugene Bolshakov <pub@relvarsoft.com> Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
This commit is contained in:
committed by
Brendan Le Foll
parent
078218f680
commit
2e5e3eaea2
@@ -29,6 +29,7 @@ if ("x_${VERSION}" STREQUAL "x_GIT-NOTFOUND" OR "x_${VERSION}" STREQUAL "x_HEAD-
|
|||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
message (INFO " - libmraa Version ${VERSION}")
|
message (INFO " - libmraa Version ${VERSION}")
|
||||||
|
message (INFO " - cmake Version ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}")
|
||||||
|
|
||||||
#parse the version information into pieces.
|
#parse the version information into pieces.
|
||||||
string (REGEX REPLACE "^v([0-9]+)\\..*" "\\1" VERSION_MAJOR "${VERSION}")
|
string (REGEX REPLACE "^v([0-9]+)\\..*" "\\1" VERSION_MAJOR "${VERSION}")
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ what you'll need:
|
|||||||
* [git](http://git-scm.com)
|
* [git](http://git-scm.com)
|
||||||
* [python](http://python.org) 2.7 or 3.4+ (you'll need not just the interpreter but python-dev)
|
* [python](http://python.org) 2.7 or 3.4+ (you'll need not just the interpreter but python-dev)
|
||||||
* [node.js](http://nodejs.org) 0.10.x or 0.12.x (you'll need not just the interpreter but nodejs-dev)
|
* [node.js](http://nodejs.org) 0.10.x or 0.12.x (you'll need not just the interpreter but nodejs-dev)
|
||||||
* [CMake](http://cmake.org) 2.8.8+
|
* [CMake](http://cmake.org) 2.8.8+ (3.1+ is recommended for node.js version 2+)
|
||||||
|
|
||||||
For Debian-like distros the below command installs the basic set:
|
For Debian-like distros the below command installs the basic set:
|
||||||
|
|
||||||
|
|||||||
@@ -25,18 +25,34 @@ swig_add_module (mraajs javascript mraajs.i ${mraa_LIB_SRCS})
|
|||||||
swig_link_libraries (mraajs ${NODE_LIBRARIES} ${mraa_LIBS})
|
swig_link_libraries (mraajs ${NODE_LIBRARIES} ${mraa_LIBS})
|
||||||
|
|
||||||
set_target_properties (mraajs PROPERTIES
|
set_target_properties (mraajs PROPERTIES
|
||||||
COMPILE_FLAGS "${CMAKE_CXX_FLAGS} -DBUILDING_NODE_EXTENSION -DSWIGJAVASCRIPT=${SWIG_FOUND}"
|
COMPILE_FLAGS " -DBUILDING_NODE_EXTENSION -DSWIGJAVASCRIPT=${SWIG_FOUND}"
|
||||||
PREFIX ""
|
PREFIX ""
|
||||||
OUTPUT_NAME mraa
|
OUTPUT_NAME mraa
|
||||||
SUFFIX ".node"
|
SUFFIX ".node"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
message (INFO " - swig Version ${SWIG_VERSION}")
|
||||||
|
message (INFO " - CXX compiler Version ${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION}")
|
||||||
|
|
||||||
if (${V8_VERSION_MAJOR} GREATER 3)
|
if (${V8_VERSION_MAJOR} GREATER 3)
|
||||||
message (INFO " - Using V8 version > 3 so requiring C++11 compiler")
|
message (INFO " - Using V8 version > 3 so requiring C++11 compiler")
|
||||||
# Node 0.12.x V8 engine major version is '3'.
|
# Node 0.12.x V8 engine major version is '3'.
|
||||||
# Node 2.1.0 V8 engine major version is '4'.
|
# Node 2.1.0 V8 engine major version is '4'.
|
||||||
set_property (TARGET mraajs PROPERTY CXX_STANDARD 11)
|
set_property (TARGET mraajs PROPERTY CXX_STANDARD 11)
|
||||||
set_property (TARGET mraajs PROPERTY CXX_STANDARD_REQUIRED ON)
|
set_property (TARGET mraajs PROPERTY CXX_STANDARD_REQUIRED ON)
|
||||||
|
if(CMAKE_VERSION VERSION_LESS "3.1")
|
||||||
|
message(INFO " - **WARNING** Need to use CMAKE version 3.1+, but it is ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}")
|
||||||
|
message(INFO " - So a workaround will be used.")
|
||||||
|
if(CMAKE_COMPILER_IS_GNUCXX)
|
||||||
|
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.7")
|
||||||
|
message(FATAL_ERROR " FATAL ERROR: GNU gcc compiler is also too old (need 4.7+, but ${CMAKE_CXX_COMPILER_VERSION}) and does not support C++11 standard.")
|
||||||
|
endif()
|
||||||
|
set(MRAA_CXX11_WORKAROUND_OPTION "-std=gnu++11")
|
||||||
|
else()
|
||||||
|
set(MRAA_CXX11_WORKAROUND_OPTION "-std=c++11")
|
||||||
|
endif()
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${MRAA_CXX11_WORKAROUND_OPTION} ")
|
||||||
|
endif()
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
macro (mraa_CREATE_INSTALL_PACKAGE_JSON generated_file install_location)
|
macro (mraa_CREATE_INSTALL_PACKAGE_JSON generated_file install_location)
|
||||||
|
|||||||
Reference in New Issue
Block a user