Skip to content

Commit

Permalink
[cotire] Update with sakra/cotire#155
Browse files Browse the repository at this point in the history
  • Loading branch information
bilke committed Mar 27, 2020
1 parent 66fa257 commit 0503702
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions cotire.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2355,12 +2355,22 @@ function (cotire_generate_target_script _language _configurations _target _targe
CMAKE_${_language}_SOURCE_FILE_EXTENSIONS)
if (DEFINED ${_var})
string (REPLACE "\"" "\\\"" _value "${${_var}}")
set (_contents "${_contents}set (${_var} \"${_value}\")\n")
if (NOT _contentsHasGeneratorExpressions)
if ("${_value}" MATCHES "\\$<.*>")

if ("${_value}" MATCHES "\\$<.*>")
# We have to evaluate generator expressions
if (NOT _contentsHasGeneratorExpressions)
set (_contentsHasGeneratorExpressions TRUE)
endif()

# Expand various generator expressions which can only be evaluated on binary targets manually
foreach(_currentReplacedGeneratorExpression "C_COMPILER_ID" "CXX_COMPILER_ID")
set(_currentReplacement ${CMAKE_${_currentReplacedGeneratorExpression}})

string (REGEX REPLACE "\\$<${_currentReplacedGeneratorExpression}:([a-zA-Z0-9]*)>" "$<STREQUAL:\\\\\"${_currentReplacement}\\\\\",\\\\\"\\1\\\\\">" _value "${_value}")
endforeach(_currentReplacedGeneratorExpression)
endif()

set (_contents "${_contents}set (${_var} \"${_value}\")\n")
endif()
endforeach()
# generate target script file
Expand Down

0 comments on commit 0503702

Please sign in to comment.