CMake/Tests/VSGNUFortran/subdir/CMakeLists.txt
Bill Hoffman 48a09f82cc CMakeAddFortranSubdirectory: Make IMPORTED targets GLOBAL
cmake_add_fortran_directory uses imported targets when using the
mingw fortran compiler. This change makes those targets global
in scope so they act just like the real targets that exist when
a fortran compiler exists and regular add_subdirectory is used.
2012-02-09 08:38:52 -05:00

16 lines
738 B
CMake

include(CMakeAddFortranSubdirectory)
# add the fortran subdirectory as a fortran project
# the subdir is fortran, the project is FortranHello
cmake_add_fortran_subdirectory(fortran
PROJECT FortranHello # project name in toplevel CMakeLists.txt
ARCHIVE_DIR ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}
RUNTIME_DIR bin # ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
LIBRARIES hello world # target libraries created
CMAKE_COMMAND_LINE
-DCMAKE_RUNTIME_OUTPUT_DIRECTORY=${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
-DCMAKE_ARCHIVE_OUTPUT_DIRECTORY=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}
-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=${CMAKE_LIBRARY_OUTPUT_DIRECTORY}
LINK_LIBRARIES # link interface libraries
LINK_LIBS hello world # hello needs world to link
)