Sha256: 7f1606971134d95bcee55c8371784744b9c0e514794889fda2bab9c979720a15

Contents?: true

Size: 1.12 KB

Versions: 9

Compression:

Stored size: 1.12 KB

Contents


cmake_minimum_required(VERSION 2.8.12)

# Make macros that can add compiler switches to the entire project.  Not just
# to the current cmake folder being built.  
macro ( add_global_compiler_switch switch_name )
   # If removing the switch would change the flags then it's already present
   # and we don't need to do anything.
   string(REPLACE "${switch_name}" "" tempstr "${CMAKE_CXX_FLAGS}")
   if ("${CMAKE_CXX_FLAGS}" STREQUAL "${tempstr}" )
      set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${switch_name}" 
         CACHE STRING "Flags used by the compiler during all C++ builds." 
         FORCE)
   endif ()
endmacro()

macro ( remove_global_compiler_switch switch_name )
   string(REPLACE "${switch_name}" "" tempstr "${CMAKE_CXX_FLAGS}")
   if (NOT "${CMAKE_CXX_FLAGS}" STREQUAL "${tempstr}" )
      set (CMAKE_CXX_FLAGS "${tempstr}" 
         CACHE STRING "Flags used by the compiler during all C++ builds." 
         FORCE)
   endif ()
endmacro()

macro (add_global_define def_name)
   add_global_compiler_switch(-D${def_name})
endmacro()

macro (remove_global_define def_name)
   remove_global_compiler_switch(-D${def_name})
endmacro()

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
dlib-1.2.2 ext/dlib-19.4/dlib/cmake_utils/add_global_compiler_switch.cmake
dlib-1.2.1 ext/dlib-19.4/dlib/cmake_utils/add_global_compiler_switch.cmake
dlib-1.2.0 ext/dlib-19.4/dlib/cmake_utils/add_global_compiler_switch.cmake
dlib-1.1.5 ext/dlib-19.4/dlib/cmake_utils/add_global_compiler_switch.cmake
dlib-1.1.4 ext/dlib-19.4/dlib/cmake_utils/add_global_compiler_switch.cmake
dlib-1.1.3 ext/dlib-19.4/dlib/cmake_utils/add_global_compiler_switch.cmake
dlib-1.1.2 ext/dlib-19.4/dlib/cmake_utils/add_global_compiler_switch.cmake
dlib-1.1.1 ext/dlib-19.4/dlib/cmake_utils/add_global_compiler_switch.cmake
dlib-1.1.0 ext/dlib-19.4/dlib/cmake_utils/add_global_compiler_switch.cmake