From 3b4aa3bf3581dc81fbdd307b9ed432a8a306a514 Mon Sep 17 00:00:00 2001 From: Alexander Neundorf Date: Mon, 21 May 2007 10:15:42 -0400 Subject: BUG: always search for ar, ranlib, etc. except under MSVC -> this should fix the mingw fortran test -also generate the fortran test with the kdevelop generator Alex --- Modules/CMakeFindBinUtils.cmake | 32 ++++++++++++++++++-------------- Tests/CMakeLists.txt | 6 ++++-- 2 files changed, 22 insertions(+), 16 deletions(-) diff --git a/Modules/CMakeFindBinUtils.cmake b/Modules/CMakeFindBinUtils.cmake index 8eb1fa2..0527397 100644 --- a/Modules/CMakeFindBinUtils.cmake +++ b/Modules/CMakeFindBinUtils.cmake @@ -15,7 +15,22 @@ # CMAKE_INSTALL_NAME_TOOL # on UNIX, cygwin and mingw -IF(UNIX OR CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX) + + +# if it's the MS C/CXX compiler, search for link +IF("${CMAKE_CXX_COMPILER_ID}" MATCHES "MSVC" OR "${CMAKE_C_COMPILER_ID}" MATCHES "MSVC") + FIND_PROGRAM(CMAKE_LINKER NAMES link PATHS ${_CMAKE_TOOLCHAIN_LOCATION} NO_DEFAULT_PATH) + FIND_PROGRAM(CMAKE_LINKER NAMES link) + + IF(NOT CMAKE_LINKER) + MESSAGE(FATAL_ERROR "Could not find link, please check your installation.") + ENDIF(NOT CMAKE_LINKER) + + MARK_AS_ADVANCED(CMAKE_LINKER) + +# in all other cases search for ar, ranlib, etc. +ELSE("${CMAKE_CXX_COMPILER_ID}" MATCHES "MSVC" OR "${CMAKE_C_COMPILER_ID}" MATCHES "MSVC") + FIND_PROGRAM(CMAKE_AR NAMES ${_CMAKE_TOOLCHAIN_PREFIX}ar PATHS ${_CMAKE_TOOLCHAIN_LOCATION} NO_DEFAULT_PATH) FIND_PROGRAM(CMAKE_AR NAMES ${_CMAKE_TOOLCHAIN_PREFIX}ar) @@ -32,9 +47,10 @@ IF(UNIX OR CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX) FIND_PROGRAM(CMAKE_LINKER NAMES ${_CMAKE_TOOLCHAIN_PREFIX}ld) MARK_AS_ADVANCED(CMAKE_AR CMAKE_RANLIB CMAKE_STRIP CMAKE_LINKER) +ENDIF("${CMAKE_CXX_COMPILER_ID}" MATCHES "MSVC" OR "${CMAKE_C_COMPILER_ID}" MATCHES "MSVC") -ENDIF(UNIX OR CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX) +# on Apple there really should be install_name_tool IF(APPLE) FIND_PROGRAM(CMAKE_INSTALL_NAME_TOOL NAMES install_name_tool PATHS ${_CMAKE_TOOLCHAIN_LOCATION} NO_DEFAULT_PATH) FIND_PROGRAM(CMAKE_INSTALL_NAME_TOOL NAMES install_name_tool) @@ -46,15 +62,3 @@ IF(APPLE) MARK_AS_ADVANCED(CMAKE_INSTALL_NAME_TOOL) ENDIF(APPLE) -IF("${CMAKE_CXX_COMPILER_ID}" MATCHES "MSVC" OR "${CMAKE_C_COMPILER_ID}" MATCHES "MSVC") - FIND_PROGRAM(CMAKE_LINKER NAMES link PATHS ${_CMAKE_TOOLCHAIN_LOCATION} NO_DEFAULT_PATH) - FIND_PROGRAM(CMAKE_LINKER NAMES link) - - IF(NOT CMAKE_LINKER) - MESSAGE(FATAL_ERROR "Could not find link, please check your installation.") - ENDIF(NOT CMAKE_LINKER) - - MARK_AS_ADVANCED(CMAKE_LINKER) -ENDIF("${CMAKE_CXX_COMPILER_ID}" MATCHES "MSVC" OR "${CMAKE_C_COMPILER_ID}" MATCHES "MSVC") - -# maybe check for more tools ? diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 59f5c08..8b6fb87 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -670,7 +670,8 @@ IF(BUILD_TESTING) # fortran does not work for IDE builds because # CMAKE_STANDARD_LIBRARIES needs to be per language - IF(CMAKE_TEST_GENERATOR MATCHES "Makefiles") + IF(CMAKE_TEST_GENERATOR MATCHES "Makefiles" + OR CMAKE_TEST_GENERATOR MATCHES "KDevelop") # see if we can find a fortran compiler on the machine # if so, add the fortran test and see if it works. SET(CMAKE_Fortran_COMPILER_LIST ifort ifc efc f95 pgf95 @@ -690,7 +691,8 @@ IF(BUILD_TESTING) --build-two-config --test-command testf) ENDIF(CMAKE_Fortran_COMPILER_FULLPATH) - ENDIF(CMAKE_TEST_GENERATOR MATCHES "Makefiles") + ENDIF(CMAKE_TEST_GENERATOR MATCHES "Makefiles" + OR CMAKE_TEST_GENERATOR MATCHES "KDevelop") IF(NOT CMAKE_TEST_GENERATOR MATCHES "Xcode") INCLUDE(FindJava) IF(JAVA_COMPILE AND JAVA_RUNTIME AND JAVA_ARCHIVE AND NOT MINGW) -- cgit v0.12