Browse Source

BUG: Propagate platform settings such as CMAKE_OSX_ARCHITECTURES to the try compile

Andy Cedilnik 18 năm trước cách đây
mục cha
commit
b9ab2b1932
2 tập tin đã thay đổi với 10 bổ sung0 xóa
  1. 5 0
      Modules/Platform/Darwin.cmake
  2. 5 0
      Source/cmTryCompileCommand.cxx

+ 5 - 0
Modules/Platform/Darwin.cmake

@@ -97,3 +97,8 @@ SET(CMAKE_SYSTEM_APPBUNDLE_PATH
 INCLUDE(Platform/UnixPaths)
 SET(CMAKE_SYSTEM_INCLUDE_PATH ${CMAKE_SYSTEM_INCLUDE_PATH} /sw/include)
 SET(CMAKE_SYSTEM_LIBRARY_PATH ${CMAKE_SYSTEM_LIBRARY_PATH} /sw/lib)
+
+IF(CMAKE_OSX_ARCHITECTURES)
+  SET(CMAKE_TRY_COMPILE_PLATFORM_OPTIONS "${CMAKE_TRY_COMPILE_PLATFORM_OPTIONS}
+    SET(CMAKE_OSX_ARCHITECTURES \"${CMAKE_OSX_ARCHITECTURES}\")")
+ENDIF(CMAKE_OSX_ARCHITECTURES)

+ 5 - 0
Source/cmTryCompileCommand.cxx

@@ -204,6 +204,11 @@ int cmTryCompileCommand::CoreTryCompileCode(
         }
       fprintf(fout, ")\n");
       }
+    const char* platformOptions = mf->GetDefinition("CMAKE_TRY_COMPILE_PLATFORM_OPTIONS");
+    if ( platformOptions )
+      {
+      fprintf(fout, "%s\n", platformOptions);
+      }
     
     fprintf(fout, "ADD_EXECUTABLE(cmTryCompileExec \"%s\")\n",source.c_str());
     fprintf(fout,