mirror of
https://github.com/reactos/CMake.git
synced 2024-11-25 20:49:41 +00:00
71402eb252
The Intel Fortran plugin for Visual Studio requires Fortran source files to be compiled in a separate target from C and C++ code. Compile the VerifyFortran.f source file in a separate library and link the main VerifyFortanC executable to it.
35 lines
1.2 KiB
CMake
35 lines
1.2 KiB
CMake
#=============================================================================
|
|
# Copyright 2009 Kitware, Inc.
|
|
#
|
|
# Distributed under the OSI-approved BSD License (the "License");
|
|
# see accompanying file Copyright.txt for details.
|
|
#
|
|
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
|
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
# See the License for more information.
|
|
#=============================================================================
|
|
|
|
cmake_minimum_required(VERSION 2.7)
|
|
project(VerifyFortranC C Fortran)
|
|
|
|
option(VERIFY_CXX "Whether to verify C++ and Fortran" OFF)
|
|
if(VERIFY_CXX)
|
|
enable_language(CXX)
|
|
set(VerifyCXX VerifyCXX.cxx)
|
|
add_definitions(-DVERIFY_CXX)
|
|
endif()
|
|
|
|
include(FortranCInterface)
|
|
|
|
FortranCInterface_HEADER(VerifyFortran.h SYMBOLS VerifyFortran)
|
|
include_directories(${VerifyFortranC_BINARY_DIR})
|
|
|
|
add_library(VerifyFortran STATIC VerifyFortran.f)
|
|
add_executable(VerifyFortranC main.c VerifyC.c ${VerifyCXX})
|
|
target_link_libraries(VerifyFortranC VerifyFortran)
|
|
|
|
if(NOT VERIFY_CXX)
|
|
# The entry point (main) is defined in C; link with the C compiler.
|
|
set_property(TARGET VerifyFortranC PROPERTY LINKER_LANGUAGE C)
|
|
endif()
|