Skip to content

Commit d270dcb

Browse files
authored
Using response files on Mac is incompatible (and unnecessary) with Ninja
1 parent 9a46ffb commit d270dcb

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

CMakeLists.txt

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -310,8 +310,10 @@ endif()
310310

311311
# Fix "Argument list too long" for macOS - mostly seen with older OS versions on POWERPC or Intel CPUs
312312
if(APPLE)
313-
# Use response files
314-
set(CMAKE_C_USE_RESPONSE_FILE_FOR_OBJECTS 1)
313+
# Use response files to get around the ARG_MAX limit, unless using the Ninja generator
314+
if("${CMAKE_GENERATOR}" MATCHES ".*Makefiles")
315+
set(CMAKE_C_USE_RESPONSE_FILE_FOR_OBJECTS 1)
316+
endif()
315317
# Always build static library first
316318
if(BUILD_STATIC_LIBS)
317319
set(STATIC_PATH "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/lib${OpenBLAS_LIBNAME}.a")
@@ -332,8 +334,10 @@ if(APPLE)
332334
set(OMP_LIB "")
333335
endif()
334336
if(NOT NOFORTRAN)
335-
set(CMAKE_Fortran_USE_RESPONSE_FILE_FOR_OBJECTS 1)
336-
set(CMAKE_Fortran_CREATE_STATIC_LIBRARY ${CREATE_STATIC_LIBRARY_COMMAND})
337+
if("${CMAKE_GENERATOR}" MATCHES ".*Makefiles")
338+
set(CMAKE_Fortran_USE_RESPONSE_FILE_FOR_OBJECTS 1)
339+
endif()
340+
set(CMAKE_Fortran_CREATE_STATIC_LIBRARY ${CREATE_STATIC_LIBRARY_COMMAND})
337341
if(BUILD_SHARED_LIBS)
338342
set(CMAKE_Fortran_CREATE_SHARED_LIBRARY
339343
"sh -c 'echo \"\" | ${CMAKE_Fortran_COMPILER} -o dummy.o -c -x f95-cpp-input - '"

0 commit comments

Comments
 (0)