Skip to content

Commit

Permalink
Use native cmake unity support:
Browse files Browse the repository at this point in the history
* Remove hand-rolled unity sources
* unity unavailable for cmake 3.15 and earlier
* remove deprecated target configure option
  • Loading branch information
mellery451 committed Feb 26, 2020
1 parent 455105d commit e9b3c58
Show file tree
Hide file tree
Showing 73 changed files with 761 additions and 2,636 deletions.
91 changes: 0 additions & 91 deletions Builds/CMake/CMakeFuncs.cmake
Original file line number Diff line number Diff line change
@@ -1,95 +1,4 @@

## "target" parsing..DEPRECATED and will be removed in future
macro(parse_target)
if (target)
# Parse the target
set(remaining ${target})
while (remaining)
# get the component up to the next dot or end
string(REGEX REPLACE "^\\.?([^\\.]+).*$" "\\1" cur_component ${remaining})
string(REGEX REPLACE "^\\.?[^\\.]+(.*$)" "\\1" remaining ${remaining})

if (${cur_component} STREQUAL gcc)
if (DEFINED ENV{GNU_CC})
set(CMAKE_C_COMPILER $ENV{GNU_CC})
elseif ($ENV{CC} MATCHES .*gcc.*)
set(CMAKE_C_COMPILER $ENV{CC})
else()
find_program(CMAKE_C_COMPILER gcc)
endif()

if (DEFINED ENV{GNU_CXX})
set(CMAKE_CXX_COMPILER $ENV{GNU_CXX})
elseif ($ENV{CXX} MATCHES .*g\\+\\+.*)
set(CMAKE_CXX_COMPILER $ENV{CXX})
else()
find_program(CMAKE_CXX_COMPILER g++)
endif()
endif()

if (${cur_component} STREQUAL clang)
if (DEFINED ENV{CLANG_CC})
set(CMAKE_C_COMPILER $ENV{CLANG_CC})
elseif ($ENV{CC} MATCHES .*clang.*)
set(CMAKE_C_COMPILER $ENV{CC})
else()
find_program(CMAKE_C_COMPILER clang)
endif()

if (DEFINED ENV{CLANG_CXX})
set(CMAKE_CXX_COMPILER $ENV{CLANG_CXX})
elseif ($ENV{CXX} MATCHES .*clang.*)
set(CMAKE_CXX_COMPILER $ENV{CXX})
else()
find_program(CMAKE_CXX_COMPILER clang++)
endif()
endif()

if (${cur_component} STREQUAL msvc)
# TBD
endif()

if (${cur_component} STREQUAL unity)
set(unity ON CACHE BOOL "" FORCE)
endif()

if (${cur_component} STREQUAL nounity)
set(unity OFF CACHE BOOL "" FORCE)
endif()

if (${cur_component} STREQUAL debug)
set(release false)
endif()

if (${cur_component} STREQUAL release)
set(release true)
endif()

if (${cur_component} STREQUAL coverage)
set(coverage ON CACHE BOOL "" FORCE)
set(debug true)
endif()

if (${cur_component} STREQUAL profile)
set(profile ON CACHE BOOL "" FORCE)
endif()
endwhile()
endif()

if(CMAKE_C_COMPILER MATCHES "-NOTFOUND$" OR
CMAKE_CXX_COMPILER MATCHES "-NOTFOUND$")
message(FATAL_ERROR "Can not find appropriate compiler for target ${target}")
endif()

if (release)
set(CMAKE_BUILD_TYPE Release)
else()
set(CMAKE_BUILD_TYPE Debug)
endif()
endmacro()

############################################################

macro(group_sources_in source_dir curdir)
file(GLOB children RELATIVE ${source_dir}/${curdir}
${source_dir}/${curdir}/*)
Expand Down
Loading

0 comments on commit e9b3c58

Please sign in to comment.