source: branches/dev-5819/ThirdParty/Sundials/sundials-2.7.0/config/SundialsSuperLUMT.cmake @ 13763

Last change on this file since 13763 was 13763, checked in by aramle, 8 weeks ago

#5819 Fixing so that Sundials can link with MSVS built SuperLU.

File size: 3.0 KB
Line 
1# ---------------------------------------------------------------
2# $Revision: 4955 $
3# $Date: 2016-09-23 10:01:28 -0700 (Fri, 23 Sep 2016) $
4# ---------------------------------------------------------------
5# Programmer:  Eddy Banks @ LLNL
6# ---------------------------------------------------------------
7# Copyright (c) 2013, The Regents of the University of California.
8# Produced at the Lawrence Livermore National Laboratory.
9# All rights reserved.
10# For details, see the LICENSE file.
11# ---------------------------------------------------------------
12# SUPERLUMT tests for SUNDIALS CMake-based configuration.
13#    - loosely based on SundialsLapack.cmake
14#
15### This is only set if running GUI - simply return first time enabled
16IF(SUPERLUMT_DISABLED)
17  SET(SUPERLUMT_DISABLED FALSE CACHE INTERNAL "GUI - SUPERLUMT now enabled" FORCE)
18  RETURN()
19ENDIF()
20
21SET(SUPERLUMT_FOUND FALSE)
22
23# set SUPERLUMT_LIBRARIES
24include(FindSUPERLUMT)
25# If we have the SUPERLUMT libraries, test them
26if(SUPERLUMT_LIBRARY AND SUPERLUMT_LIBRARIES)
27  message(STATUS "Looking for SUPERLUMT libraries... OK")
28  # Create the SUPERLUMT_TEST directory
29  set(SUPERLUMT_TEST_DIR ${PROJECT_BINARY_DIR}/SUPERLUMT_TEST)
30  file(MAKE_DIRECTORY ${SUPERLUMT_TEST_DIR})
31  # Create a CMakeLists.txt file
32  file(WRITE ${SUPERLUMT_TEST_DIR}/CMakeLists.txt
33    "CMAKE_MINIMUM_REQUIRED(VERSION 2.4)\n"
34    "PROJECT(ltest C)\n"
35    "SET(CMAKE_VERBOSE_MAKEFILE ON)\n"
36    "SET(CMAKE_BUILD_TYPE \"${CMAKE_BUILD_TYPE}\")\n"
37    "SET(CMAKE_C_FLAGS \"${CMAKE_C_FLAGS}\")\n"
38    "SET(CMAKE_C_FLAGS_RELEASE \"${CMAKE_C_FLAGS_RELEASE}\")\n"
39    "SET(CMAKE_C_FLAGS_DEBUG \"${CMAKE_C_FLAGS_DEBUG}\")\n"
40    "SET(CMAKE_C_FLAGS_RELWITHDEBUGINFO \"${CMAKE_C_FLAGS_RELWITHDEBUGINFO}\")\n"
41    "SET(CMAKE_C_FLAGS_MINSIZE \"${CMAKE_C_FLAGS_MINSIZE}\")\n"
42    "if(MSVC)\n"
43    "    ADD_DEFINITIONS(/D __OPENMP)\n"
44    "endif()\n"
45    "INCLUDE_DIRECTORIES(${SUPERLUMT_INCLUDE_DIR})\n"
46    "ADD_EXECUTABLE(ltest ltest.c)\n"
47    "TARGET_LINK_LIBRARIES(ltest ${SUPERLUMT_LIBRARIES})\n")   
48# Create a C source file which calls a SUPERLUMT function
49  file(WRITE ${SUPERLUMT_TEST_DIR}/ltest.c
50    "\#include \"slu_mt_ddefs.h\"\n"
51#    "\#include \"pdsp_defs.h\"\n"
52    "int main(){\n"
53    "SuperMatrix A;\n"
54    "NCformat *Astore;\n" 
55    "return(0);\n"
56    "}\n")
57  # Attempt to link the "ltest" executable
58  try_compile(LTEST_OK ${SUPERLUMT_TEST_DIR} ${SUPERLUMT_TEST_DIR} ltest OUTPUT_VARIABLE MY_OUTPUT)
59     
60  # To ensure we do not use stuff from the previous attempts,
61  # we must remove the CMakeFiles directory.
62  file(REMOVE_RECURSE ${SUPERLUMT_TEST_DIR}/CMakeFiles)
63  # Process test result
64  if(LTEST_OK)
65    message(STATUS "Checking if SUPERLUMT works... OK")
66    set(SUPERLUMT_FOUND TRUE)
67  else(LTEST_OK)
68    message(STATUS "Checking if SUPERLUMT works... FAILED")
69  endif(LTEST_OK)
70
71else()
72  PRINT_WARNING("SUPERLUMT LIBRARIES NOT Found. Please check library path" "${SUPERLUMT_LIBRARY_DIR} ")
73  message(STATUS "Looking for SUPERLUMT libraries... FAILED")
74endif()
Note: See TracBrowser for help on using the repository browser.