X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FMEFISTO2%2FCMakeLists.txt;h=5841fbcda5c9cc46204dde9a4fa2cf6f03e60119;hp=7521891368623874023c49190577be7303993c83;hb=a0f09b9f1b8f5eac0e1c9277f76d65eb643cac94;hpb=1bd4ba8acdfe7ab1edc96a016836e174a393d445 diff --git a/src/MEFISTO2/CMakeLists.txt b/src/MEFISTO2/CMakeLists.txt index 752189136..5841fbcda 100644 --- a/src/MEFISTO2/CMakeLists.txt +++ b/src/MEFISTO2/CMakeLists.txt @@ -1,9 +1,9 @@ -# Copyright (C) 2012-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2012-2014 CEA/DEN, EDF R&D, OPEN CASCADE # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either -# version 2.1 of the License. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -48,16 +48,54 @@ SET(MEFISTO2D_HEADERS # --- sources --- -# sources / static -SET(MEFISTO2D_SOURCES - aptrte.cxx - trte.f -) +IF(${F2C_FOUND}) +ADD_DEFINITIONS() + SET(F2C_INPUT ${CMAKE_CURRENT_SOURCE_DIR}/trte.f) + SET(F2C_OUTPUT trte.c) + + # additional include directories + INCLUDE_DIRECTORIES(${f2c_INCLUDE_DIRS}) + + # additional preprocessor / compiler flags + ADD_DEFINITIONS(-DF2C_BUILD) + + + # libraries to link to + SET(_link_LIBRARIES ${_link_LIBRARIES} ${f2c_LIBRARIES}) + + # generate C sources from Fortran + ADD_CUSTOM_COMMAND( + OUTPUT ${F2C_OUTPUT} + COMMAND ${f2c_GENERATOR} ${F2C_INPUT} + MAIN_DEPENDENCY ${F2C_INPUT} + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + ) + # sources / static + SET(MEFISTO2D_SOURCES + aptrte.cxx + ${F2C_OUTPUT} + ) +ELSE(${F2C_FOUND}) + # sources / static + SET(MEFISTO2D_SOURCES + aptrte.cxx + trte.f + ) +ENDIF(${F2C_FOUND}) # --- rules --- ADD_LIBRARY(MEFISTO2D ${MEFISTO2D_SOURCES}) TARGET_LINK_LIBRARIES(MEFISTO2D ${_link_LIBRARIES} ) -INSTALL(TARGETS MEFISTO2D EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS}) +#Ignore MSVCRT.lib on WINDOWS in case using f2c code generator +IF(WIN32) + IF(CMAKE_BUILD_TYPE STREQUAL Debug) + IF(${F2C_FOUND}) + SET_TARGET_PROPERTIES(MEFISTO2D PROPERTIES LINK_FLAGS "/NODEFAULTLIB:MSVCRT") + ENDIF(${F2C_FOUND}) + ENDIF() +ENDIF(WIN32) + +INSTALL(TARGETS MEFISTO2D EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS}) INSTALL(FILES ${MEFISTO2D_HEADERS} DESTINATION ${SALOME_INSTALL_HEADERS})