Browse Source

CMake build process: Workaround for an old CMake on Linux.

bubnikv 7 years ago
parent
commit
ff4e8d94c0
2 changed files with 14 additions and 5 deletions
  1. 9 5
      CMakeLists.txt
  2. 5 0
      xs/CMakeLists.txt

+ 9 - 5
CMakeLists.txt

@@ -8,11 +8,15 @@ if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
   set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Build type (default Release)" FORCE)
 endif()
 
-if (MSVC OR MINGW OR APPLE)
-	set(SLIC3R_STATIC_INITIAL 1)
-else ()
-	set(SLIC3R_STATIC_INITIAL 0)
-endif ()
+if(DEFINED ENV{SLIC3R_STATIC})
+	set(SLIC3R_STATIC_INITIAL $ENV{SLIC3R_STATIC})
+else()
+	if (MSVC OR MINGW OR APPLE)
+		set(SLIC3R_STATIC_INITIAL 1)
+	else()
+		set(SLIC3R_STATIC_INITIAL 0)
+	endif()
+endif()
 
 option(SLIC3R_STATIC 			"Compile Slic3r with static libraries (Boost, TBB, glew)" ${SLIC3R_STATIC_INITIAL})
 option(SLIC3R_GUI    			"Compile Slic3r with GUI components (OpenGL, wxWidgets)" 1)

+ 5 - 0
xs/CMakeLists.txt

@@ -5,6 +5,11 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
 # Add our own cmake module path.
 list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/modules/)
 
+if (UNIX)
+    # Workaround for an old CMake, which does not understand CMAKE_CXX_STANDARD.
+    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall")
+endif()
+
 # Where all the bundled libraries reside?
 set(LIBDIR ${CMAKE_CURRENT_SOURCE_DIR}/src/)
 # For the bundled boost libraries (boost::nowide)