Jelajahi Sumber

CMakeAddFortranSubdirectory: Always parse arguments

Parse arguments even in add_subdirectory() mode to validate them.
Brad King 13 tahun lalu
induk
melakukan
6f6891b337
1 mengubah file dengan 5 tambahan dan 4 penghapusan
  1. 5 4
      Modules/CMakeAddFortranSubdirectory.cmake

+ 5 - 4
Modules/CMakeAddFortranSubdirectory.cmake

@@ -99,6 +99,11 @@ endfunction()
 
 
 
 
 function(cmake_add_fortran_subdirectory subdir)
 function(cmake_add_fortran_subdirectory subdir)
+  # Parse arguments to function
+  set(oneValueArgs PROJECT ARCHIVE_DIR RUNTIME_DIR)
+  set(multiValueArgs LIBRARIES LINK_LIBRARIES CMAKE_COMMAND_LINE)
+  cmake_parse_arguments(ARGS "" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
+
   # if we are not using MSVC without fortran support
   # if we are not using MSVC without fortran support
   # then just use the usual add_subdirectory to build
   # then just use the usual add_subdirectory to build
   # the fortran library
   # the fortran library
@@ -111,10 +116,6 @@ function(cmake_add_fortran_subdirectory subdir)
   # if we have MSVC without Intel fortran then setup
   # if we have MSVC without Intel fortran then setup
   # external projects to build with mingw fortran
   # external projects to build with mingw fortran
 
 
-  # Parse arguments to function
-  set(oneValueArgs PROJECT ARCHIVE_DIR RUNTIME_DIR)
-  set(multiValueArgs LIBRARIES LINK_LIBRARIES CMAKE_COMMAND_LINE)
-  cmake_parse_arguments(ARGS "" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
   set(source_dir "${CMAKE_CURRENT_SOURCE_DIR}/${subdir}")
   set(source_dir "${CMAKE_CURRENT_SOURCE_DIR}/${subdir}")
   set(project_name "${ARGS_PROJECT}")
   set(project_name "${ARGS_PROJECT}")
   set(library_dir "${ARGS_ARCHIVE_DIR}")
   set(library_dir "${ARGS_ARCHIVE_DIR}")