Skip to content

Commit

Permalink
configuration changes to enable c++14
Browse files Browse the repository at this point in the history
  • Loading branch information
kdt3rd authored and nickrasmussen committed Aug 8, 2018
1 parent 9651bb4 commit f257dc0
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
18 changes: 18 additions & 0 deletions IlmBase/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,16 @@ OPTION (BUILD_SHARED_LIBS "Build Shared Libraries" ON)
# Allow the developer to select if Dynamic or Static libraries are built
OPTION (NAMESPACE_VERSIONING "Namespace Versioning" ON)

OPTION (FORCE_CXX03 "Force CXX03" OFF)
IF (FORCE_CXX03)
ADD_DEFINITIONS ( -std=c++03 )
ELSE (FORCE_CXX03)
# VP18 switches to c++14, so let's do that
SET(CMAKE_CXX_STANDARD 14)
# but switch gnu++14 or other extensions off for portability
SET(CMAKE_CXX_EXTENSIONS OFF)
ENDIF ()

# Setup osx rpathing
SET (CMAKE_MACOSX_RPATH 1)
SET (BUILD_WITH_INSTALL_RPATH 1)
Expand Down Expand Up @@ -130,6 +140,14 @@ ELSE ()
ENDIF ()
ENDIF ()

IF (FORCE_CXX03)
FILE ( WRITE ${CMAKE_CURRENT_BINARY_DIR}/config/IlmBaseConfig.h "#define ILMBASE_FORCE_CXX03 1\n" )
ELSE ()
# really only care about c++11 right now for the threading bits, but this can be changed to 14
# when needed...
FILE ( WRITE ${CMAKE_CURRENT_BINARY_DIR}/config/IlmBaseConfig.h "#if __cplusplus < 201103L\n# error \"Modern C++ 11/14 not enabled but force cxx98 not set\"\n#endif\n" )
ENDIF ()

IF (NAMESPACE_VERSIONING)
FILE ( APPEND ${CMAKE_CURRENT_BINARY_DIR}/config/IlmBaseConfig.h "#define ILMBASE_INTERNAL_NAMESPACE_CUSTOM 1\n")
FILE ( APPEND ${CMAKE_CURRENT_BINARY_DIR}/config/IlmBaseConfig.h "#define IMATH_INTERNAL_NAMESPACE Imath_${ILMBASE_VERSION_API}\n")
Expand Down
7 changes: 7 additions & 0 deletions IlmBase/config/IlmBaseConfig.h.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
//
// Define and set to 1 if the target system has c++11/14 support
// and you want IlmBase to NOT use it's features
//

#undef ILMBASE_FORCE_CXX03

//
// Define and set to 1 if the target system has POSIX thread support
// and you want IlmBase to use it for multithreaded file I/O.
Expand Down

0 comments on commit f257dc0

Please sign in to comment.