The intermediate file, cmake.definitions, is moved into
the intermediate directory: bin/obj/OS.Arch.Conf/
The script won't emit error for not having the cmake
results because some systems (Windows) do not use Cmake
and users might use "skipnative".
Fixes dotnet/coreclr#5976
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Commit migrated from https://github.com/dotnet/coreclr/commit/
5acbced129024a38aec530f1bb9cd85b7568e05a
get_directory_property( DirDefs COMPILE_DEFINITIONS )
# Reset the definition file
-file(WRITE cmake.definitions "")
+file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/cmake.definitions "")
foreach( d ${DirDefs} )
if($ENV{VERBOSE})
message( STATUS "Compiler Definition: " ${d} )
endif($ENV{VERBOSE})
- file(APPEND cmake.definitions ${d})
- file(APPEND cmake.definitions "\n")
+ file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/cmake.definitions ${d})
+ file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/cmake.definitions "\n")
endforeach()
<Message Importance="High" Text="============" />
<PropertyGroup>
<IgnoreDefineConstants>FEATURE_IMPLICIT_TLS;FEATURE_HIJACK</IgnoreDefineConstants>
+ <CMakeDefinitionSaveFile>$(IntermediateOutputPath)\cmake.definitions</CMakeDefinitionSaveFile>
</PropertyGroup>
- <Exec Command='python $(MSBuildThisFileDirectory)../scripts/check-definitions.py $(MSBuildThisFileDirectory)../../cmake.definitions "$(DefineConstants)" "$(IgnoreDefineConstants)" ' />
+ <Exec Command='python $(MSBuildThisFileDirectory)..\scripts\check-definitions.py "$(CMakeDefinitionSaveFile)" "$(DefineConstants)" "$(IgnoreDefineConstants)" ' />
<Message Importance="High" Text="============" />
</Target>
# For the native part, return the sorted definition array.
def loadDefinitionFile(filename):
result = []
- f = open(filename, 'r')
+ try:
+ f = open(filename, 'r')
+ except:
+ sys.exit(0)
+ # if cmake was not used (because of skipnative or systems that do not use cmake), this script won't work.
+
for line in f:
theLine = line.rstrip("\r\n").strip()
if (len(theLine) > 0):