summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2008-12-02 07:08:40 -0500
committerBill Hoffman <bill.hoffman@kitware.com>2008-12-02 07:08:40 -0500
commit989d9b748dd1b0303ff72385f27dc7c7e258285b (patch)
treeb5a4101b5ed3e5a307a0e82cd8d3fcbb0844b812
parentccdab21b4a63ff757348f1b22e8d2b97966f2efc (diff)
downloadcmake-989d9b748dd1b0303ff72385f27dc7c7e258285b.tar.gz
ENH: merge in RC 5
-rw-r--r--CMakeLists.txt2
-rw-r--r--ChangeLog.manual14
-rw-r--r--Modules/CMakeASM-ATTInformation.cmake2
-rw-r--r--Modules/CMakeDetermineASM-ATTCompiler.cmake2
-rw-r--r--Modules/CMakeDetermineASMCompiler.cmake2
-rw-r--r--Modules/CMakeDetermineFortranCompiler.cmake28
-rw-r--r--Modules/CMakeTestASM-ATTCompiler.cmake1
-rw-r--r--Modules/CTest.cmake4
-rw-r--r--Modules/FindQt4.cmake53
-rw-r--r--Modules/FortranCInterface.cmake231
-rw-r--r--Modules/FortranCInterface.h.in9
-rw-r--r--Modules/InstallRequiredSystemLibraries.cmake24
-rw-r--r--Modules/Platform/SunOS-SunPro-Fortran.cmake7
-rw-r--r--Modules/Platform/Windows-g77.cmake7
-rw-r--r--Source/CTest/cmCTestScriptHandler.cxx25
-rw-r--r--Source/CTest/cmCTestTestCommand.cxx10
-rw-r--r--Source/CTest/cmCTestTestCommand.h15
-rw-r--r--Source/cmIncludeExternalMSProjectCommand.h5
-rw-r--r--Source/cmInstallTargetGenerator.cxx9
-rw-r--r--Source/cmMakefile.cxx15
-rw-r--r--Source/cmMakefile.h5
-rw-r--r--Source/cmake.cxx3
-rw-r--r--Source/kwsys/CTestConfig.cmake10
-rw-r--r--Templates/TestDriver.cxx.in6
-rw-r--r--Tests/Fortran/CMakeLists.txt170
-rw-r--r--Utilities/cmcurl/CMakeLists.txt5
26 files changed, 580 insertions, 84 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 28b2ce1ab9..4558251817 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -354,7 +354,7 @@ ENDMACRO (CMAKE_BUILD_UTILITIES)
SET(CMake_VERSION_MAJOR 2)
SET(CMake_VERSION_MINOR 6)
SET(CMake_VERSION_PATCH 3)
-SET(CMake_VERSION_RC 4)
+SET(CMake_VERSION_RC 5)
# CVS versions are odd, if this is an odd minor version
# then set the CMake_VERSION_DATE variable
IF("${CMake_VERSION_MINOR}" MATCHES "[13579]$")
diff --git a/ChangeLog.manual b/ChangeLog.manual
index 5568f4a3e5..e1f2997dd0 100644
--- a/ChangeLog.manual
+++ b/ChangeLog.manual
@@ -1,3 +1,17 @@
+Changes in CMake 2.6.3 RC 5
+- add EXCLUDE, INCLUDE to ctest_test command in ctest -S scripts
+- Set CMAKE_SYSTEM in ctest -S scripts by reading CMakeDetermineSystem
+- Fix for GetLibraryNamesInternal called on imported target issue on osx
+- Add FortranCInterface.cmake module to discover Fortran/C interfaces
+- Fix Fortran compiler specified with -D issue
+- Add support for the MS masm and masm64 assemblers, works with nmake/make
+- Improvments to FindQt4.cmake
+- InstallRequiredSystemLibraries fix for win64
+- Fix flags for Sun Fortran, and g77
+- Fix imported library issue with OSX
+- Fix -D and CACHE FORCE issue
+- Have kwsys submit dashboards to cdash.org
+
Changes in CMake 2.6.3 RC 4
- Fix for SccProvider in visual studio
- fix for missing package_source target
diff --git a/Modules/CMakeASM-ATTInformation.cmake b/Modules/CMakeASM-ATTInformation.cmake
index fb44b102a1..353473af93 100644
--- a/Modules/CMakeASM-ATTInformation.cmake
+++ b/Modules/CMakeASM-ATTInformation.cmake
@@ -1,3 +1,5 @@
+# support for AT&T syntax assemblers, e.g. GNU as
+
SET(ASM_DIALECT "-ATT")
SET(CMAKE_ASM${ASM_DIALECT}_SOURCE_FILE_EXTENSIONS s;S;asm)
INCLUDE(CMakeASMInformation)
diff --git a/Modules/CMakeDetermineASM-ATTCompiler.cmake b/Modules/CMakeDetermineASM-ATTCompiler.cmake
index 71e98c289c..5861159ec3 100644
--- a/Modules/CMakeDetermineASM-ATTCompiler.cmake
+++ b/Modules/CMakeDetermineASM-ATTCompiler.cmake
@@ -1,4 +1,4 @@
-# determine the compiler to use for ASM using AT&T syntax
+# determine the compiler to use for ASM using AT&T syntax, e.g. GNU as
SET(ASM_DIALECT "-ATT")
SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT ${_CMAKE_TOOLCHAIN_PREFIX}gas ${_CMAKE_TOOLCHAIN_PREFIX}as)
diff --git a/Modules/CMakeDetermineASMCompiler.cmake b/Modules/CMakeDetermineASMCompiler.cmake
index eac8c55cdd..da7194af95 100644
--- a/Modules/CMakeDetermineASMCompiler.cmake
+++ b/Modules/CMakeDetermineASMCompiler.cmake
@@ -17,7 +17,7 @@ IF(NOT CMAKE_ASM${ASM_DIALECT}_COMPILER)
IF (_CMAKE_USER_CXX_COMPILER_PATH OR _CMAKE_USER_C_COMPILER_PATH)
FIND_PROGRAM(CMAKE_ASM${ASM_DIALECT}_COMPILER NAMES ${CMAKE_ASM${ASM_DIALECT}_COMPILER_LIST} PATHS ${_CMAKE_USER_C_COMPILER_PATH} ${_CMAKE_USER_CXX_COMPILER_PATH} DOC "Assembler" NO_DEFAULT_PATH)
ENDIF (_CMAKE_USER_CXX_COMPILER_PATH OR _CMAKE_USER_C_COMPILER_PATH)
- FIND_PROGRAM(CMAKE_ASM${ASM_DIALECT}_COMPILER NAMES ${CMAKE_ASM${ASM_DIALECT}_COMPILER_LIST} DOC "Assembler")
+ FIND_PROGRAM(CMAKE_ASM${ASM_DIALECT}_COMPILER NAMES ${CMAKE_ASM${ASM_DIALECT}_COMPILER_LIST} PATHS ${_CMAKE_TOOLCHAIN_LOCATION} DOC "Assembler")
ELSE(NOT CMAKE_ASM${ASM_DIALECT}_COMPILER)
diff --git a/Modules/CMakeDetermineFortranCompiler.cmake b/Modules/CMakeDetermineFortranCompiler.cmake
index defb5a7f8d..7afa5ee3d5 100644
--- a/Modules/CMakeDetermineFortranCompiler.cmake
+++ b/Modules/CMakeDetermineFortranCompiler.cmake
@@ -53,7 +53,7 @@ IF(NOT CMAKE_Fortran_COMPILER)
# CMake/Source/CMakeLists.txt, IF YOU CHANGE THIS LIST,
# PLEASE UPDATE THAT FILE AS WELL!
SET(CMAKE_Fortran_COMPILER_LIST
- ifort ifc efc f95 pgf95 lf95 xlf95 fort gfortran g95 f90
+ ifort ifc efc f95 pgf95 lf95 xlf95 fort gfortran gfortran-4 g95 f90
pgf90 xlf90 epcf90 fort77 frt pgf77 xlf fl32 af77 g77 f77
)
ENDIF(CMAKE_Fortran_COMPILER_INIT)
@@ -63,6 +63,32 @@ IF(NOT CMAKE_Fortran_COMPILER)
IF(CMAKE_Fortran_COMPILER_INIT AND NOT CMAKE_Fortran_COMPILER)
SET(CMAKE_Fortran_COMPILER "${CMAKE_Fortran_COMPILER_INIT}" CACHE FILEPATH "Fortran compiler" FORCE)
ENDIF(CMAKE_Fortran_COMPILER_INIT AND NOT CMAKE_Fortran_COMPILER)
+ELSE(NOT CMAKE_Fortran_COMPILER)
+ # we only get here if CMAKE_Fortran_COMPILER was specified using -D or a pre-made CMakeCache.txt
+ # (e.g. via ctest) or set in CMAKE_TOOLCHAIN_FILE
+ # if CMAKE_Fortran_COMPILER is a list of length 2, use the first item as
+ # CMAKE_Fortran_COMPILER and the 2nd one as CMAKE_Fortran_COMPILER_ARG1
+
+ LIST(LENGTH CMAKE_Fortran_COMPILER _CMAKE_Fortran_COMPILER_LIST_LENGTH)
+ IF("${_CMAKE_Fortran_COMPILER_LIST_LENGTH}" EQUAL 2)
+ LIST(GET CMAKE_Fortran_COMPILER 1 CMAKE_Fortran_COMPILER_ARG1)
+ LIST(GET CMAKE_Fortran_COMPILER 0 CMAKE_Fortran_COMPILER)
+ ENDIF("${_CMAKE_Fortran_COMPILER_LIST_LENGTH}" EQUAL 2)
+
+ # if a compiler was specified by the user but without path,
+ # now try to find it with the full path
+ # if it is found, force it into the cache,
+ # if not, don't overwrite the setting (which was given by the user) with "NOTFOUND"
+ # if the C compiler already had a path, reuse it for searching the CXX compiler
+ GET_FILENAME_COMPONENT(_CMAKE_USER_Fortran_COMPILER_PATH "${CMAKE_Fortran_COMPILER}" PATH)
+ IF(NOT _CMAKE_USER_Fortran_COMPILER_PATH)
+ FIND_PROGRAM(CMAKE_Fortran_COMPILER_WITH_PATH NAMES ${CMAKE_Fortran_COMPILER})
+ MARK_AS_ADVANCED(CMAKE_Fortran_COMPILER_WITH_PATH)
+ IF(CMAKE_Fortran_COMPILER_WITH_PATH)
+ SET(CMAKE_Fortran_COMPILER ${CMAKE_Fortran_COMPILER_WITH_PATH}
+ CACHE STRING "Fortran compiler" FORCE)
+ ENDIF(CMAKE_Fortran_COMPILER_WITH_PATH)
+ ENDIF(NOT _CMAKE_USER_Fortran_COMPILER_PATH)
ENDIF(NOT CMAKE_Fortran_COMPILER)
MARK_AS_ADVANCED(CMAKE_Fortran_COMPILER)
diff --git a/Modules/CMakeTestASM-ATTCompiler.cmake b/Modules/CMakeTestASM-ATTCompiler.cmake
index 3844f5bdad..1b4ef4fa71 100644
--- a/Modules/CMakeTestASM-ATTCompiler.cmake
+++ b/Modules/CMakeTestASM-ATTCompiler.cmake
@@ -4,6 +4,7 @@
# and link the most basic of programs. If not, a fatal error
# is set and cmake stops processing commands and will not generate
# any makefiles or projects.
+
SET(ASM_DIALECT "-ATT")
INCLUDE(CMakeTestASMCompiler)
SET(ASM_DIALECT)
diff --git a/Modules/CTest.cmake b/Modules/CTest.cmake
index 10d6ff51f5..952e18eed6 100644
--- a/Modules/CTest.cmake
+++ b/Modules/CTest.cmake
@@ -1,5 +1,5 @@
-# - Configure a project for testing with CTest/Dart
-# This file configures a project to use the CTest/Dart
+# - Configure a project for testing with CTest/CDash
+# This file configures a project to use the CTest/CDash/Dart
# testing/dashboard process. This module should be included
# in the CMakeLists.txt file at the top of a project. Typical usage:
# INCLUDE(CTest)
diff --git a/Modules/FindQt4.cmake b/Modules/FindQt4.cmake
index 9b06b323e6..fbfe80a4bd 100644
--- a/Modules/FindQt4.cmake
+++ b/Modules/FindQt4.cmake
@@ -643,8 +643,8 @@ IF (QT4_QMAKE_FOUND)
FIND_LIBRARY(QT_QTASSISTANTCLIENT_LIBRARY_DEBUG NAMES QtAssistantClient_debug QtAssistantClientd QtAssistantClientd4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH)
# Set QT_QTASSISTANT_LIBRARY
- FIND_LIBRARY(QT_QTASSISTANT_LIBRARY_RELEASE NAMES QtAssistantClient QtAssistantClient4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH)
- FIND_LIBRARY(QT_QTASSISTANT_LIBRARY_DEBUG NAMES QtAssistantClient_debug QtAssistantClientd QtAssistantClientd4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH)
+ FIND_LIBRARY(QT_QTASSISTANT_LIBRARY_RELEASE NAMES QtAssistantClient QtAssistantClient4 QtAssistant QtAssistant4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH)
+ FIND_LIBRARY(QT_QTASSISTANT_LIBRARY_DEBUG NAMES QtAssistantClient_debug QtAssistantClientd QtAssistantClientd4 QtAssistant_debug QtAssistantd4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH)
# Set QT_QTHELP_LIBRARY
FIND_LIBRARY(QT_QTCLUCENE_LIBRARY_RELEASE NAMES QtCLucene QtCLucene4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH)
@@ -752,9 +752,30 @@ IF (QT4_QMAKE_FOUND)
#######################################
+ # find moc and uic using qmake
+ QT_QUERY_QMAKE(QT_MOC_EXECUTABLE_INTERNAL "QMAKE_MOC")
+ QT_QUERY_QMAKE(QT_UIC_EXECUTABLE_INTERNAL "QMAKE_UIC")
+
+ # make sure we have / and not \ as qmake gives on windows
+ FILE(TO_CMAKE_PATH
+ "${QT_MOC_EXECUTABLE_INTERNAL}" QT_MOC_EXECUTABLE_INTERNAL)
+ # make sure we have / and not \ as qmake gives on windows
+ FILE(TO_CMAKE_PATH
+ "${QT_UIC_EXECUTABLE_INTERNAL}" QT_UIC_EXECUTABLE_INTERNAL)
+
+ IF(QT_QMAKE_CHANGED)
+ SET(QT_MOC_EXECUTABLE
+ ${QT_MOC_EXECUTABLE_INTERNAL} CACHE FILEPATH "The moc executable" FORCE)
+ SET(QT_UIC_EXECUTABLE
+ ${QT_UIC_EXECUTABLE_INTERNAL} CACHE FILEPATH "The uic executable" FORCE)
+ ELSE(QT_QMAKE_CHANGED)
+ SET(QT_MOC_EXECUTABLE
+ ${QT_MOC_EXECUTABLE_INTERNAL} CACHE FILEPATH "The moc executable")
+ SET(QT_UIC_EXECUTABLE
+ ${QT_UIC_EXECUTABLE_INTERNAL} CACHE FILEPATH "The uic executable")
+ ENDIF(QT_QMAKE_CHANGED)
+
IF(QT_QMAKE_CHANGED)
- SET(QT_MOC_EXECUTABLE NOTFOUND)
- SET(QT_UIC_EXECUTABLE NOTFOUND)
SET(QT_UIC3_EXECUTABLE NOTFOUND)
SET(QT_RCC_EXECUTABLE NOTFOUND)
SET(QT_DBUSCPP2XML_EXECUTABLE NOTFOUND)
@@ -762,18 +783,6 @@ IF (QT4_QMAKE_FOUND)
SET(QT_LUPDATE_EXECUTABLE NOTFOUND)
SET(QT_LRELEASE_EXECUTABLE NOTFOUND)
ENDIF(QT_QMAKE_CHANGED)
-
- FIND_PROGRAM(QT_MOC_EXECUTABLE
- NAMES moc
- PATHS ${QT_BINARY_DIR}
- NO_DEFAULT_PATH
- )
-
- FIND_PROGRAM(QT_UIC_EXECUTABLE
- NAMES uic
- PATHS ${QT_BINARY_DIR}
- NO_DEFAULT_PATH
- )
FIND_PROGRAM(QT_UIC3_EXECUTABLE
NAMES uic3
@@ -855,12 +864,14 @@ IF (QT4_QMAKE_FOUND)
SET(_checkinfile ${CMAKE_CURRENT_SOURCE_DIR})
IF(_infileLength GREATER _binlength)
STRING(SUBSTRING "${infile}" 0 ${_binlength} _checkinfile)
- ENDIF(_infileLength GREATER _binlength)
- IF(CMAKE_CURRENT_BINARY_DIR MATCHES "${_checkinfile}")
- FILE(RELATIVE_PATH rel ${CMAKE_CURRENT_BINARY_DIR} ${infile})
- ELSE(CMAKE_CURRENT_BINARY_DIR MATCHES "${_checkinfile}")
+ IF(_checkinfile STREQUAL "${CMAKE_CURRENT_BINARY_DIR}")
+ FILE(RELATIVE_PATH rel ${CMAKE_CURRENT_BINARY_DIR} ${infile})
+ ELSE(_checkinfile STREQUAL "${CMAKE_CURRENT_BINARY_DIR}")
+ FILE(RELATIVE_PATH rel ${CMAKE_CURRENT_SOURCE_DIR} ${infile})
+ ENDIF(_checkinfile STREQUAL "${CMAKE_CURRENT_BINARY_DIR}")
+ ELSE(_infileLength GREATER _binlength)
FILE(RELATIVE_PATH rel ${CMAKE_CURRENT_SOURCE_DIR} ${infile})
- ENDIF(CMAKE_CURRENT_BINARY_DIR MATCHES "${_checkinfile}")
+ ENDIF(_infileLength GREATER _binlength)
SET(_outfile "${CMAKE_CURRENT_BINARY_DIR}/${rel}")
STRING(REPLACE ".." "__" _outfile ${_outfile})
GET_FILENAME_COMPONENT(outpath ${_outfile} PATH)
diff --git a/Modules/FortranCInterface.cmake b/Modules/FortranCInterface.cmake
new file mode 100644
index 0000000000..6551658c76
--- /dev/null
+++ b/Modules/FortranCInterface.cmake
@@ -0,0 +1,231 @@
+# FortranCInterface.cmake
+#
+# This file defines the function create_fortran_c_interface.
+# this function is used to create a configured header file
+# that contains a mapping from C to a Fortran function using
+# the correct name mangling scheme as defined by the current
+# fortran compiler.
+#
+# The function tages a list of functions and the name of
+# a header file to configure.
+#
+# This file also defines some helper functions that are used
+# to detect the fortran name mangling scheme used by the
+# current Fortran compiler.
+# test_fortran_mangling - test a single fortran mangling
+# discover_fortran_mangling - loop over all combos of fortran
+# name mangling and call test_fortran_mangling until one of them
+# works.
+# discover_fortran_module_mangling - try different types of
+# fortran modle name mangling to find one that works
+#
+#
+#
+# this function tests a single fortran mangling.
+# CODE - test code to try should define a subroutine called "sub"
+# PREFIX - string to put in front of sub
+# POSTFIX - string to put after sub
+# ISUPPER - if TRUE then sub will be called as SUB
+# DOC - string used in status checking Fortran ${DOC} linkage
+# SUB - the name of the SUB to call
+# RESULT place to store result TRUE if this linkage works, FALSE
+# if not.
+#
+function(test_fortran_mangling CODE PREFIX ISUPPER POSTFIX DOC SUB RESULT)
+ if(ISUPPER)
+ string(TOUPPER "${SUB}" sub)
+ else(ISUPPER)
+ string(TOLOWER "${SUB}" sub)
+ endif(ISUPPER)
+ set(FUNCTION "${PREFIX}${sub}${POSTFIX}")
+ # create a fortran file with sub called sub
+ #
+ set(TMP_DIR
+ "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckFortranLink")
+ file(REMOVE_RECURSE "${TMP_DIR}")
+ file(WRITE "${TMP_DIR}/test.f" "${CODE}" )
+ message(STATUS "checking Fortran ${DOC} linkage: ${FUNCTION}")
+ file(WRITE "${TMP_DIR}/ctof.c"
+ "
+ extern ${FUNCTION}();
+ int main() { ${FUNCTION}(); return 0;}
+ "
+ )
+ file(WRITE "${TMP_DIR}/CMakeLists.txt"
+ "
+ project(testf C Fortran)
+ add_library(flib test.f)
+ add_executable(ctof ctof.c)
+ target_link_libraries(ctof flib)
+ "
+ )
+ set(FORTRAN_NAME_MANGLE_TEST FALSE)
+ try_compile(FORTRAN_NAME_MANGLE_TEST "${TMP_DIR}" "${TMP_DIR}"
+ testf
+ OUTPUT_VARIABLE output)
+ if(FORTRAN_NAME_MANGLE_TEST)
+ set(${RESULT} TRUE PARENT_SCOPE)
+ else()
+ set(${RESULT} FALSE PARENT_SCOPE)
+ endif()
+endfunction(test_fortran_mangling)
+
+# this function discovers the name mangling scheme used
+# for functions in a fortran module.
+function(discover_fortran_module_mangling prefix suffix found)
+ set(CODE
+ "
+ module test_interface
+ interface dummy
+ module procedure sub
+ end interface
+ contains
+ subroutine sub
+ end subroutine
+ end module test_interface
+ ")
+ set(worked FALSE)
+ foreach(interface
+ "test_interface$"
+ "TEST_INTERFACE_mp_"
+ "_test_interface__"
+ "__test_interface__"
+ "__test_interface_NMOD_"
+ "__test_interface_MOD_")
+ test_fortran_mangling("${CODE}" "${interface}"
+ ${FORTRAN_C_MANGLING_UPPERCASE} "" "module" "sub" worked)
+ if(worked)
+ # if this is the upper case module match then
+ # lower case it for the extraction of pre and post strings
+ if("${interface}" MATCHES "TEST_INTERFACE")
+ string(TOLOWER "${interface}" interface)
+ endif()
+ string(REGEX REPLACE "(.*)test_interface(.*)" "\\1" pre "${interface}")
+ string(REGEX REPLACE "(.*)test_interface(.*)" "\\2" post "${interface}")
+ set(${prefix} "${pre}" PARENT_SCOPE)
+ set(${suffix} "${post}" PARENT_SCOPE)
+ set(${found} TRUE PARENT_SCOPE)
+ return()
+ endif(worked)
+ endforeach(interface)
+ if(NOT worked)
+ message(STATUS "Failed to find C binding to Fortran module functions.")
+ set(${prefix} "BROKEN_C_FORTRAN_MODULE_BINDING" PARENT_SCOPE)
+ set(${suffix} "BROKEN_C_FORTRAN_MODULE_BINDING" PARENT_SCOPE)
+ set(${found} FALSE PARENT_SCOPE)
+ endif(NOT worked)
+endfunction(discover_fortran_module_mangling)
+
+
+function(discover_fortran_mangling prefix isupper suffix extra_under_score
+ found )
+ set(CODE
+ "
+ subroutine sub
+ end subroutine sub
+ ")
+ foreach(post "_" "")
+ foreach(isup FALSE TRUE)
+ foreach(pre "" "_" "__")
+ set(worked FALSE)
+ test_fortran_mangling("${CODE}" "${pre}" ${isup}
+ "${post}" "function" sub worked )
+ if(worked)
+ message(STATUS "found Fortran function linkage")
+ set(${isupper} "${isup}" PARENT_SCOPE)
+ set(${prefix} "${pre}" PARENT_SCOPE)
+ set(${suffix} "${post}" PARENT_SCOPE)
+ set(${found} TRUE PARENT_SCOPE)
+ set(CODE
+ "
+ subroutine my_sub
+ end subroutine my_sub
+ ")
+ set(worked FALSE)
+ test_fortran_mangling("${CODE}" "${pre}" ${isup}
+ "${post}" "function with _ " my_sub worked )
+ if(worked)
+ set(${extra_under_score} FALSE PARENT_SCOPE)
+ else(worked)
+ test_fortran_mangling("${CODE}" "${pre}" ${isup}
+ "${post}_" "function with _ " my_sub worked )
+ if(worked)
+ set(${extra_under_score} TRUE PARENT_SCOPE)
+ endif(worked)
+ endif(worked)
+ return()
+ endif()
+ endforeach()
+ endforeach()
+ endforeach()
+ set(${found} FALSE PARENT_SCOPE)
+endfunction(discover_fortran_mangling)
+
+function(create_fortran_c_interface NAMESPACE FUNCTIONS HEADER)
+ if(NOT FORTRAN_C_MANGLING_FOUND)
+ # find regular fortran function mangling
+ discover_fortran_mangling(prefix isupper suffix extra_under found)
+ if(NOT found)
+ message(SEND_ERROR "Could not find fortran c name mangling.")
+ return()
+ endif(NOT found)
+ # find fortran module function mangling
+ set(FORTRAN_C_PREFIX "${prefix}" CACHE INTERNAL
+ "PREFIX for Fortran to c name mangling")
+ set(FORTRAN_C_SUFFIX "${suffix}" CACHE INTERNAL
+ "SUFFIX for Fortran to c name mangling")
+ set(FORTRAN_C_MANGLING_UPPERCASE ${isupper} CACHE INTERNAL
+ "Was fortran to c mangling found" )
+ set(FORTRAN_C_MANGLING_EXTRA_UNDERSCORE ${extra_under} CACHE INTERNAL
+ "If a function has a _ in the name does the compiler append an extra _" )
+ set(FORTRAN_C_MANGLING_FOUND TRUE CACHE INTERNAL
+ "Was fortran to c mangling found" )
+ set(prefix )
+ set(suffix )
+ set(found FALSE)
+ # only try this if the compiler is F90 compatible
+ if(CMAKE_Fortran_COMPILER_SUPPORTS_F90)
+ discover_fortran_module_mangling(prefix suffix found)
+ endif(CMAKE_Fortran_COMPILER_SUPPORTS_F90)
+ if(found)
+ message(STATUS "found Fortran module linkage")
+ else(found)
+ message(STATUS "Failed to find Fortran module linkage")
+ endif(found)
+ set(FORTRAN_C_MODULE_PREFIX "${prefix}" CACHE INTERNAL
+ "PREFIX for Fortran to c name mangling")
+ set(FORTRAN_C_MODULE_SUFFIX "${suffix}" CACHE INTERNAL
+ "SUFFIX for Fortran to c name mangling")
+ set(FORTRAN_C_MODULE_MANGLING_FOUND ${found} CACHE INTERNAL
+ "Was for Fortran to c name mangling found for modules")
+ endif(NOT FORTRAN_C_MANGLING_FOUND)
+ foreach(f ${${FUNCTIONS}})
+ if(FORTRAN_C_MANGLING_UPPERCASE)
+ string(TOUPPER "${f}" fcase)
+ else()
+ string(TOLOWER "${f}" fcase)
+ endif()
+ if("${f}" MATCHES ":")
+ string(REGEX REPLACE "(.*):(.*)" "\\1" module "${f}")
+ string(REGEX REPLACE "(.*):(.*)" "\\2" function "${f}")
+ string(REGEX REPLACE "(.*):(.*)" "\\1" module_case "${fcase}")
+ string(REGEX REPLACE "(.*):(.*)" "\\2" function_case "${fcase}")
+ set(HEADER_CONTENT "${HEADER_CONTENT}
+#define ${NAMESPACE}${module}_${function} ${FORTRAN_C_MODULE_PREFIX}${module_case}${FORTRAN_C_MODULE_SUFFIX}${function_case}
+")
+ else("${f}" MATCHES ":")
+ set(function "${FORTRAN_C_PREFIX}${fcase}${FORTRAN_C_SUFFIX}")
+ if("${f}" MATCHES "_" AND FORTRAN_C_MANGLING_EXTRA_UNDERSCORE)
+ set(function "${function}_")
+ endif("${f}" MATCHES "_" AND FORTRAN_C_MANGLING_EXTRA_UNDERSCORE)
+ set(HEADER_CONTENT "${HEADER_CONTENT}
+#define ${NAMESPACE}${f} ${function}
+")
+ endif("${f}" MATCHES ":")
+ endforeach(f)
+ configure_file(
+ "${CMAKE_ROOT}/Modules/FortranCInterface.h.in"
+ ${HEADER} @ONLY)
+ message(STATUS "created ${HEADER}")
+endfunction()
+
diff --git a/Modules/FortranCInterface.h.in b/Modules/FortranCInterface.h.in
new file mode 100644
index 0000000000..02501758fd
--- /dev/null
+++ b/Modules/FortranCInterface.h.in
@@ -0,0 +1,9 @@
+/* This file is automatically generated by CMake, DO NOT EDIT.
+ It contains a mapping from Fortran functions so they can
+ be called from C or C++. */
+
+
+@HEADER_CONTENT@
+
+
+
diff --git a/Modules/InstallRequiredSystemLibraries.cmake b/Modules/InstallRequiredSystemLibraries.cmake
index 7744dfa19d..057924c921 100644
--- a/Modules/InstallRequiredSystemLibraries.cmake
+++ b/Modules/InstallRequiredSystemLibraries.cmake
@@ -14,12 +14,14 @@
IF(MSVC)
FILE(TO_CMAKE_PATH "$ENV{SYSTEMROOT}" SYSTEMROOT)
+
IF(MSVC70)
SET(__install__libs
"${SYSTEMROOT}/system32/msvcp70.dll"
"${SYSTEMROOT}/system32/msvcr70.dll"
)
ENDIF(MSVC70)
+
IF(MSVC71)
SET(__install__libs
"${SYSTEMROOT}/system32/msvcp71.dll"
@@ -33,10 +35,15 @@ IF(MSVC)
SET(CMAKE_MSVC_ARCH x86)
ENDIF(CMAKE_CL_64)
+ GET_FILENAME_COMPONENT(devenv_dir "${CMAKE_MAKE_PROGRAM}" PATH)
+ GET_FILENAME_COMPONENT(base_dir "${devenv_dir}/../.." ABSOLUTE)
+
IF(MSVC80)
# Find the runtime library redistribution directory.
FIND_PATH(MSVC80_REDIST_DIR NAMES ${CMAKE_MSVC_ARCH}/Microsoft.VC80.CRT/Microsoft.VC80.CRT.manifest
- PATHS "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\8.0;InstallDir]/../../VC/redist"
+ PATHS
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\8.0;InstallDir]/../../VC/redist"
+ "${base_dir}/VC/redist"
)
MARK_AS_ADVANCED(MSVC80_REDIST_DIR)
SET(MSVC80_CRT_DIR "${MSVC80_REDIST_DIR}/${CMAKE_MSVC_ARCH}/Microsoft.VC80.CRT")
@@ -62,16 +69,18 @@ IF(MSVC)
ENDIF(CMAKE_INSTALL_DEBUG_LIBRARIES)
ENDIF(MSVC80)
+
IF(MSVC90)
# Find the runtime library redistribution directory.
FIND_PATH(MSVC90_REDIST_DIR NAMES ${CMAKE_MSVC_ARCH}/Microsoft.VC90.CRT/Microsoft.VC90.CRT.manifest
- PATHS "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\9.0;InstallDir]/../../VC/redist"
-
- "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VCExpress\\9.0;InstallDir]/../../VC/redist"
+ PATHS
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\9.0;InstallDir]/../../VC/redist"
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VCExpress\\9.0;InstallDir]/../../VC/redist"
+ "${base_dir}/VC/redist"
)
MARK_AS_ADVANCED(MSVC90_REDIST_DIR)
SET(MSVC90_CRT_DIR "${MSVC90_REDIST_DIR}/${CMAKE_MSVC_ARCH}/Microsoft.VC90.CRT")
-
+
# Install the manifest that allows DLLs to be loaded from the
# directory containing the executable.
SET(__install__libs
@@ -91,6 +100,7 @@ IF(MSVC)
)
ENDIF(CMAKE_INSTALL_DEBUG_LIBRARIES)
ENDIF(MSVC90)
+
IF(CMAKE_INSTALL_MFC_LIBRARIES)
IF(MSVC70)
SET(__install__libs ${__install__libs}
@@ -142,6 +152,7 @@ IF(MSVC)
"${MSVC80_MFCLOC_DIR}/mfc80kor.dll"
)
ENDIF(MSVC80)
+
IF(MSVC90)
IF(CMAKE_INSTALL_DEBUG_LIBRARIES)
SET(MSVC90_MFC_DIR
@@ -184,6 +195,7 @@ IF(MSVC)
ENDIF(MSVC90)
ENDIF(CMAKE_INSTALL_MFC_LIBRARIES)
+
FOREACH(lib
${__install__libs}
)
@@ -205,5 +217,3 @@ IF(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS)
ENDIF(WIN32)
ENDIF(NOT CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP)
ENDIF(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS)
-
-
diff --git a/Modules/Platform/SunOS-SunPro-Fortran.cmake b/Modules/Platform/SunOS-SunPro-Fortran.cmake
index 5739c58e88..1006bf28ef 100644
--- a/Modules/Platform/SunOS-SunPro-Fortran.cmake
+++ b/Modules/Platform/SunOS-SunPro-Fortran.cmake
@@ -1,2 +1,5 @@
-SET(CMAKE_Fortran_MODDIR_FLAG "-moddir=")
-SET(CMAKE_Fortran_MODPATH_FLAG "-M")
+set(CMAKE_Fortran_MODDIR_FLAG "-moddir=")
+set(CMAKE_Fortran_MODPATH_FLAG "-M")
+set(CMAKE_EXECUTABLE_RUNTIME_Fortran_FLAG "-R")
+set(CMAKE_SHARED_LIBRARY_Fortran_FLAGS "-KPIC")
+
diff --git a/Modules/Platform/Windows-g77.cmake b/Modules/Platform/Windows-g77.cmake
index 193b925272..ad24db6789 100644
--- a/Modules/Platform/Windows-g77.cmake
+++ b/Modules/Platform/Windows-g77.cmake
@@ -14,3 +14,10 @@ SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "") # -rpath
SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP "") # : or empty
SET(CMAKE_LIBRARY_PATH_FLAG "-L")
SET(CMAKE_LINK_LIBRARY_FLAG "-l")
+SET (CMAKE_Fortran_FLAGS_INIT "")
+SET (CMAKE_Fortran_FLAGS_DEBUG_INIT "-g")
+SET (CMAKE_Fortran_FLAGS_MINSIZEREL_INIT "-O1")
+SET (CMAKE_Fortran_FLAGS_RELEASE_INIT "-O2")
+SET (CMAKE_Fortran_FLAGS_RELWITHDEBINFO_INIT "-02 -g")
+
+
diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx
index 40926adbd6..db54c92eba 100644
--- a/Source/CTest/cmCTestScriptHandler.cxx
+++ b/Source/CTest/cmCTestScriptHandler.cxx
@@ -380,10 +380,35 @@ int cmCTestScriptHandler::ReadInScript(const std::string& total_script_arg)
f->CTestScriptHandler = this;
this->Makefile->AddFunctionBlocker(f);
+ /* Execute CMakeDetermineSystem and CMakeSystemSpecificInformation, so
+ that variables like CMAKE_SYSTEM and also the search paths for libraries,
+ header and executables are set correctly and can be used. Makes new-style
+ ctest scripting easier. */
+ std::string systemFile =
+ this->Makefile->GetModulesFile("CMakeDetermineSystem.cmake");
+ if (!this->Makefile->ReadListFile(0, systemFile.c_str()) ||
+ cmSystemTools::GetErrorOccuredFlag())
+ {
+ return 2;
+ }
+
+ systemFile =
+ this->Makefile->GetModulesFile("CMakeSystemSpecificInformation.cmake");
+ if (!this->Makefile->ReadListFile(0, systemFile.c_str()) ||
+ cmSystemTools::GetErrorOccuredFlag())
+ {
+ cmCTestLog(this->CTest, DEBUG, "Error in read: " << systemFile.c_str()
+ << std::endl);
+ return 2;
+ }
+
// finally read in the script
if (!this->Makefile->ReadListFile(0, script.c_str()) ||
cmSystemTools::GetErrorOccuredFlag())
{
+ cmCTestLog(this->CTest, DEBUG, "Error in read script: "
+ << script.c_str()
+ << std::endl);
return 2;
}
diff --git a/Source/CTest/cmCTestTestCommand.cxx b/Source/CTest/cmCTestTestCommand.cxx
index 4c962e92ed..b6f298ad03 100644
--- a/Source/CTest/cmCTestTestCommand.cxx
+++ b/Source/CTest/cmCTestTestCommand.cxx
@@ -24,6 +24,8 @@ cmCTestTestCommand::cmCTestTestCommand()
this->Arguments[ctt_START] = "START";
this->Arguments[ctt_END] = "END";
this->Arguments[ctt_STRIDE] = "STRIDE";
+ this->Arguments[ctt_EXCLUDE] = "EXCLUDE";
+ this->Arguments[ctt_INCLUDE] = "INCLUDE";
this->Arguments[ctt_LAST] = 0;
this->Last = ctt_LAST;
}
@@ -68,6 +70,14 @@ cmCTestGenericHandler* cmCTestTestCommand::InitializeHandler()
handler->SetOption("TestsToRunInformation",
testsToRunString.str().c_str());
}
+ if(this->Values[ctt_EXCLUDE])
+ {
+ handler->SetOption("ExcludeRegularExpression", this->Values[ctt_EXCLUDE]);
+ }
+ if(this->Values[ctt_INCLUDE])
+ {
+ handler->SetOption("IncludeRegularExpression", this->Values[ctt_INCLUDE]);
+ }
return handler;
}
diff --git a/Source/CTest/cmCTestTestCommand.h b/Source/CTest/cmCTestTestCommand.h
index 895de0009d..b4fcadb565 100644
--- a/Source/CTest/cmCTestTestCommand.h
+++ b/Source/CTest/cmCTestTestCommand.h
@@ -44,7 +44,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual const char* GetName() { return "CTEST_TEST";}
+ virtual const char* GetName() { return "ctest_test";}
/**
* Succinct documentation.
@@ -60,9 +60,16 @@ public:
virtual const char* GetFullDocumentation()
{
return
- " CTEST_TEST([BUILD build_dir] [RETURN_VALUE res])\n"
+ " ctest_test([BUILD build_dir]\n"
+ " [START start number] [END end number]\n"
+ " [STRIDE stride number] [EXCLUDE exclude regex ]\n"
+ " [INCLUDE include regex] [RETURN_VALUE res] )\n"
"Tests the given build directory and stores results in Test.xml. The "
- "second argument is a variable that will hold value.";
+ "second argument is a variable that will hold value. Optionally, "
+ "you can specify the starting test number START, the ending test number "
+ "END, the number of tests to skip between each test STRIDE, a regular "
+ "expression for tests to run INCLUDE, or a regular expression for tests "
+ "to not run EXCLUDE.";
}
cmTypeMacro(cmCTestTestCommand, cmCTestHandlerCommand);
@@ -77,6 +84,8 @@ protected:
ctt_START,
ctt_END,
ctt_STRIDE,
+ ctt_EXCLUDE,
+ ctt_INCLUDE,
ctt_LAST
};
};
diff --git a/Source/cmIncludeExternalMSProjectCommand.h b/Source/cmIncludeExternalMSProjectCommand.h
index c8b7e36f1f..84f3b9db7b 100644
--- a/Source/cmIncludeExternalMSProjectCommand.h
+++ b/Source/cmIncludeExternalMSProjectCommand.h
@@ -66,7 +66,10 @@ public:
" include_external_msproject(projectname location\n"
" dep1 dep2 ...)\n"
"Includes an external Microsoft project in the generated workspace "
- "file. Currently does nothing on UNIX.";
+ "file. Currently does nothing on UNIX. This will create a "
+ "target named INCLUDE_EXTERNAL_MSPROJECT_[projectname]. This can "
+ "be used in the add_dependencies command to make things depend "
+ "on the external project.";
}
cmTypeMacro(cmIncludeExternalMSProjectCommand, cmCommand);
diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx
index 68dd586849..fabcb0a703 100644
--- a/Source/cmInstallTargetGenerator.cxx
+++ b/Source/cmInstallTargetGenerator.cxx
@@ -489,10 +489,17 @@ cmInstallTargetGenerator
for(std::set<cmTarget*>::const_iterator j = sharedLibs.begin();
j != sharedLibs.end(); ++j)
{
+ cmTarget* tgt = *j;
+
+ // The install_name of an imported target does not change.
+ if(tgt->IsImported())
+ {
+ continue;
+ }
+
// If the build tree and install tree use different path
// components of the install_name field then we need to create a
// mapping to be applied after installation.
- cmTarget* tgt = *j;
std::string for_build = tgt->GetInstallNameDirForBuildTree(config);
std::string for_install = tgt->GetInstallNameDirForInstallTree(config);
if(for_build != for_install)
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 85aa6f547e..424ca00143 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -1561,7 +1561,8 @@ void cmMakefile::AddDefinition(const char* name, const char* value)
void cmMakefile::AddCacheDefinition(const char* name, const char* value,
const char* doc,
- cmCacheManager::CacheEntryType type)
+ cmCacheManager::CacheEntryType type,
+ bool force)
{
const char* val = value;
cmCacheManager::CacheIterator it =
@@ -1569,7 +1570,12 @@ void cmMakefile::AddCacheDefinition(const char* name, const char* value,
if(!it.IsAtEnd() && (it.GetType() == cmCacheManager::UNINITIALIZED) &&
it.Initialized())
{
- val = it.GetValue();
+ // if this is not a force, then use the value from the cache
+ // if it is a force, then use the value being passed in
+ if(!force)
+ {
+ val = it.GetValue();
+ }
if ( type == cmCacheManager::PATH || type == cmCacheManager::FILEPATH )
{
std::vector<std::string>::size_type cc;
@@ -1653,6 +1659,11 @@ void cmMakefile::RemoveDefinition(const char* name)
#endif
}
+void cmMakefile::RemoveCacheDefinition(const char* name)
+{
+ this->GetCacheManager()->RemoveCacheEntry(name);
+}
+
void cmMakefile::SetProjectName(const char* p)
{
this->ProjectName = p;
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index d9967c0ae4..5a12d2edce 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -264,7 +264,8 @@ public:
///! Add a definition to this makefile and the global cmake cache.
void AddCacheDefinition(const char* name, const char* value,
const char* doc,
- cmCacheManager::CacheEntryType type);
+ cmCacheManager::CacheEntryType type,
+ bool force = false);
/**
* Add bool variable definition to the build.
@@ -278,6 +279,8 @@ public:
* for cache entries, and will only affect the current makefile.
*/
void RemoveDefinition(const char* name);
+ ///! Remove a definition from the cache.
+ void RemoveCacheDefinition(const char* name);
/**
* Specify the name of the project for this build.
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index fe37afeb25..4f9f71202f 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -3937,7 +3937,8 @@ int cmake::VisualStudioLink(std::vector<std::string>& args, int type)
std::cout << "Visual Studio Incremental Link without manifests\n";
}
}
- return cmake::VisualStudioLinkNonIncremental(expandedArgs, type, hasManifest, verbose);
+ return cmake::VisualStudioLinkNonIncremental(expandedArgs,
+ type, hasManifest, verbose);
}
int cmake::ParseVisualStudioLinkCommand(std::vector<std::string>& args,
diff --git a/Source/kwsys/CTestConfig.cmake b/Source/kwsys/CTestConfig.cmake
index 23a5bd1725..e4e7b0da12 100644
--- a/Source/kwsys/CTestConfig.cmake
+++ b/Source/kwsys/CTestConfig.cmake
@@ -1,3 +1,7 @@
-SET (CTEST_PROJECT_NAME "kwsys")
-SET (CTEST_NIGHTLY_START_TIME "21:00:00 EDT")
-SET (CTEST_DART_SERVER_VERSION "2")
+set (CTEST_PROJECT_NAME "kwsys")
+set (CTEST_NIGHTLY_START_TIME "21:00:00 EDT")
+set (CTEST_DART_SERVER_VERSION "2")
+set(CTEST_DROP_METHOD "http")
+set(CTEST_DROP_SITE "www.cdash.org")
+set(CTEST_DROP_LOCATION "/CDash/submit.php?project=PublicDashboard")
+set(CTEST_DROP_SITE_CDASH TRUE)
diff --git a/Templates/TestDriver.cxx.in b/Templates/TestDriver.cxx.in
index 41fccaeb16..8c9f54efeb 100644
--- a/Templates/TestDriver.cxx.in
+++ b/Templates/TestDriver.cxx.in
@@ -70,7 +70,11 @@ int main(int ac, char *av[])
printf("To run a test, enter the test number: ");
fflush(stdout);
testNum = 0;
- scanf("%d", &testNum);
+ if( scanf("%d", &testNum) != 1 )
+ {
+ printf("Couldn't parse that input as a number\n");
+ return -1;
+ }
if (testNum >= NumTests)
{
printf("%3d is an invalid test number.\n", testNum);
diff --git a/Tests/Fortran/CMakeLists.txt b/Tests/Fortran/CMakeLists.txt
index ca7d89a4de..e8515c4005 100644
--- a/Tests/Fortran/CMakeLists.txt
+++ b/Tests/Fortran/CMakeLists.txt
@@ -1,44 +1,146 @@
cmake_minimum_required (VERSION 2.6)
-PROJECT(testf Fortran)
-SET(CMAKE_VERBOSE_MAKEFILE 1)
-MESSAGE("ENV_FLAGS = $ENV{FFLAGS}")
-MESSAGE("CMAKE_Fortran_COMPILER_INIT = ${CMAKE_Fortran_COMPILER_INIT}")
-MESSAGE("CMAKE_Fortran_COMPILER_FULLPATH = ${CMAKE_Fortran_COMPILER_FULLPATH}")
-MESSAGE("CMAKE_Fortran_COMPILER = ${CMAKE_Fortran_COMPILER}")
-MESSAGE("CMAKE_Fortran_FLAGS = ${CMAKE_Fortran_FLAGS}")
-ADD_EXECUTABLE(testf hello.f)
+project(testf Fortran C)
+message("CTEST_FULL_OUTPUT ")
+set(CMAKE_VERBOSE_MAKEFILE 1)
+message("ENV_FLAGS = $ENV{FFLAGS}")
+message("CMAKE_Fortran_COMPILER_INIT = ${CMAKE_Fortran_COMPILER_INIT}")
+message("CMAKE_Fortran_COMPILER_FULLPATH = ${CMAKE_Fortran_COMPILER_FULLPATH}")
+message("CMAKE_Fortran_COMPILER = ${CMAKE_Fortran_COMPILER}")
+message("CMAKE_Fortran_FLAGS = ${CMAKE_Fortran_FLAGS}")
+add_executable(testf hello.f)
-SET(TEST_MODULE_DEPENDS 0)
-IF(CMAKE_Fortran_COMPILER_SUPPORTS_F90)
- ADD_EXECUTABLE(test_module
+
+function(test_fortran_c_interface_module)
+ message(STATUS "Testing FortranCInterface module")
+ # test the C to Fortran interface module
+ include(FortranCInterface)
+ if(CMAKE_Fortran_COMPILER_SUPPORTS_F90)
+ if(FORTRAN_C_MODULE_MANGLING_FOUND)
+ set(srcs foo.f)
+ set(FORTRAN_FUNCTIONS test_mod:sub)
+ else(FORTRAN_C_MODULE_MANGLING_FOUND)
+ if(CMAKE_Fortran_COMPILER_ID MATCHES "SunPro|MIPSpro")
+ message("${CMAKE_Fortran_COMPILER_ID} compilers do not support"
+ " linking Fortran module procedures from C")
+ else()
+ message("This will fail, but let the user see the error")
+ set(srcs foo.f)
+ set(FORTRAN_FUNCTIONS test_mod:sub)
+ endif()
+ endif(FORTRAN_C_MODULE_MANGLING_FOUND)
+ endif()
+ set(FORTRAN_FUNCTIONS ${FORTRAN_FUNCTIONS} my_sub mysub )
+ set(srcs ${srcs} mysub.f foo.c)
+ create_fortran_c_interface("F_" FORTRAN_FUNCTIONS
+ "${testf_BINARY_DIR}/foo.h")
+ include_directories("${testf_BINARY_DIR}")
+
+ # if the name mangling is not found for a F90 compiler
+ # print out some diagnostic stuff for the dashboard
+ if(CMAKE_Fortran_COMPILER_SUPPORTS_F90)
+ if(NOT FORTRAN_C_MODULE_MANGLING_FOUND)
+ file(GLOB_RECURSE O_OBJFILES
+ "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckFortranLink/*.o"
+ "*.o" )
+ file(GLOB_RECURSE OBJ_OBJFILES
+ "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckFortranLink/*.obj")
+ find_program(DUMPBIN dumpbin)
+ find_program(NM nm)
+ foreach(ofile ${O_OBJFILES} ${OBJ_OBJFILES})
+ if(DEPENDS)
+ execute_process(COMMAND ${DUMPBIN} /symbols "${ofile}"
+ OUTPUT_VARIABLE out)
+ message("symbols in ${ofile}:\n${out}")
+ endif()
+ if(NM)
+ execute_process(COMMAND ${NM} "${ofile}" OUTPUT_VARIABLE out)
+ message("symbols in ${ofile}:\n${out}")
+ endif()
+ endforeach()
+ endif()
+ endif()
+ message("Fortran = ${CMAKE_Fortran_COMPILER_ID}")
+ message("C = ${CMAKE_C_COMPILER_ID}")
+ add_executable(foo ${srcs})
+ if(NOT ("$ENV{EXTRA_FORTRAN_C_LIBS}" STREQUAL ""))
+ message(STATUS
+ "linking in extra C to Fortran libs $ENV{EXTRA_FORTRAN_C_LIBS}")
+ target_link_libraries(foo $ENV{EXTRA_FORTRAN_C_LIBS})
+ endif()
+ # print out some stuff to help debug on machines via cdash
+ file(READ "${testf_BINARY_DIR}/foo.h" fooh)
+ message("foo.h contents:\n${fooh}")
+endfunction()
+
+# if the id's match or the compilers are compatible, then
+# call the test_fortran_c_interface_module function
+if(("${CMAKE_Fortran_COMPILER_ID}" MATCHES "Intel")
+ AND
+ ("${CMAKE_C_COMPILER_ID}" MATCHES "MSVC")
+ )
+ set(COMPATABLE_COMPILERS TRUE)
+endif()
+if(COMPATABLE_COMPILERS
+ OR ("${CMAKE_Fortran_COMPILER_ID}" MATCHES "${CMAKE_C_COMPILER_ID}" ))
+ test_fortran_c_interface_module()
+else()
+ message("Fortran does not match c compiler")
+ message("Fortran = ${CMAKE_Fortran_COMPILER_ID}")
+ message("C = ${CMAKE_C_COMPILER_ID}")
+ # hack to make g77 work after CL has been enabled
+ # as a languge, cmake needs language specific versions
+ # of these variables....
+ if(WIN32 AND "${CMAKE_Fortran_COMPILER_ID}" MATCHES "GNU")
+ set(CMAKE_CREATE_CONSOLE_EXE )
+ set(CMAKE_LIBRARY_PATH_FLAG "-L")
+ set(CMAKE_LINK_LIBRARY_FLAG "-l")
+ set(CMAKE_LINK_LIBRARY_SUFFIX )
+ endif()
+ # gnu and sunpro do not use the same flags here...
+ # however if LDFLAGS is used to set -m64 it causes odd stuf
+ # with the fortran build
+ if( ("${CMAKE_C_COMPILER_ID}" MATCHES "GNU")
+ AND ("${CMAKE_Fortran_COMPILER_ID}" MATCHES "SunPro"))
+ set(CMAKE_EXE_LINKER_FLAGS "")
+ set(CMAKE_Fortran_FLAGS "")
+ endif()
+
+endif()
+
+
+
+
+set(TEST_MODULE_DEPENDS 0)
+if(CMAKE_Fortran_COMPILER_SUPPORTS_F90)
+ add_executable(test_module
test_module_main.f90
test_module_implementation.f90
test_module_interface.f90)
- ADD_EXECUTABLE(test_use_in_comment_fixedform
+ add_executable(test_use_in_comment_fixedform
test_use_in_comment_fixedform.f)
- ADD_EXECUTABLE(test_use_in_comment_freeform
+ add_executable(test_use_in_comment_freeform
test_use_in_comment_freeform.f90)
- ADD_EXECUTABLE(test_in_interface
+ add_executable(test_in_interface
in_interface/main.f90
in_interface/module.f90)
- ADD_DEFINITIONS(-DFOO -DBAR=1)
- ADD_EXECUTABLE(test_preprocess test_preprocess.F90)
+ add_definitions(-DFOO -DBAR=1)
+ add_executable(test_preprocess test_preprocess.F90)
- SET(TEST_MODULE_DEPENDS 1)
-ENDIF(CMAKE_Fortran_COMPILER_SUPPORTS_F90)
+ set(TEST_MODULE_DEPENDS 1)
+endif(CMAKE_Fortran_COMPILER_SUPPORTS_F90)
-IF(TEST_MODULE_DEPENDS)
+if(TEST_MODULE_DEPENDS)
# Build the external project separately using a custom target.
# Make sure it uses the same build configuration as this test.
- IF(CMAKE_CONFIGURATION_TYPES)
- SET(External_CONFIG_TYPE -C "${CMAKE_CFG_INTDIR}")
- ELSE(CMAKE_CONFIGURATION_TYPES)
- SET(External_CONFIG_TYPE)
- ENDIF(CMAKE_CONFIGURATION_TYPES)
- ADD_CUSTOM_COMMAND(
+ if(CMAKE_CONFIGURATION_TYPES)
+ set(External_CONFIG_TYPE -C "${CMAKE_CFG_INTDIR}")
+ else(CMAKE_CONFIGURATION_TYPES)
+ set(External_CONFIG_TYPE)
+ endif(CMAKE_CONFIGURATION_TYPES)
+ add_custom_command(
OUTPUT ${testf_BINARY_DIR}/ExternalProject
COMMAND ${CMAKE_CTEST_COMMAND}
ARGS ${External_CONFIG_TYPE}
@@ -57,15 +159,15 @@ IF(TEST_MODULE_DEPENDS)
-DCMAKE_Fortran_FLAGS_MINSIZEREL:STRING=${CMAKE_Fortran_FLAGS_MINSIZEREL}
-DCMAKE_Fortran_FLAGS_RELWITHDEBINFO:STRING=${CMAKE_Fortran_FLAGS_RELWITHDEBINFO}
)
- ADD_CUSTOM_TARGET(ExternalTarget ALL DEPENDS ${testf_BINARY_DIR}/ExternalProject)
+ add_custom_target(ExternalTarget ALL DEPENDS ${testf_BINARY_DIR}/ExternalProject)
# Test module output directory if available.
- IF(CMAKE_Fortran_MODDIR_FLAG)
- SET(Library_MODDIR "${testf_BINARY_DIR}/Library/modules")
- ELSE(CMAKE_Fortran_MODDIR_FLAG)
- SET(Library_MODDIR "${testf_BINARY_DIR}/Library")
- ENDIF(CMAKE_Fortran_MODDIR_FLAG)
+ if(CMAKE_Fortran_MODDIR_FLAG)
+ set(Library_MODDIR "${testf_BINARY_DIR}/Library/modules")
+ else(CMAKE_Fortran_MODDIR_FLAG)
+ set(Library_MODDIR "${testf_BINARY_DIR}/Library")
+ endif(CMAKE_Fortran_MODDIR_FLAG)
- ADD_SUBDIRECTORY(Library)
- ADD_SUBDIRECTORY(Executable)
-ENDIF(TEST_MODULE_DEPENDS)
+ add_subdirectory(Library)
+ add_subdirectory(Executable)
+endif(TEST_MODULE_DEPENDS)
diff --git a/Utilities/cmcurl/CMakeLists.txt b/Utilities/cmcurl/CMakeLists.txt
index bd5ddfb171..a04b08cdfd 100644
--- a/Utilities/cmcurl/CMakeLists.txt
+++ b/Utilities/cmcurl/CMakeLists.txt
@@ -153,7 +153,10 @@ MACRO(CHECK_LIBRARY_EXISTS_CONCAT LIBRARY SYMBOL VARIABLE)
ENDMACRO(CHECK_LIBRARY_EXISTS_CONCAT)
# Check for all needed libraries
-CHECK_LIBRARY_EXISTS_CONCAT("dl" dlopen HAVE_LIBDL)
+# use the cmake defined dl libs as dl is should not be used
+# on HPUX, but rather dld this avoids a warning
+SET(CURL_LIBS ${CURL_LIBS} ${CMAKE_DL_LIBS})
+#CHECK_LIBRARY_EXISTS_CONCAT("dl" dlopen HAVE_LIBDL)
#CHECK_LIBRARY_EXISTS_CONCAT("ucb" gethostname HAVE_LIBUCB)
CHECK_LIBRARY_EXISTS_CONCAT("socket" connect HAVE_LIBSOCKET)
CHECK_LIBRARY_EXISTS("c" gethostbyname "" NOT_NEED_LIBNSL)