# CMAKE File for "adelus_driver" application building against an installed Trilinos cmake_minimum_required(VERSION 3.12) cmake_policy(SET CMP0057 NEW) # Use Trilinos_PREFIX, if the user set it, to help find Trilinos. # The final location will actually be held in Trilinos_DIR which must # point at "/lib/cmake/Trilinos", but this helps the search. SET(CMAKE_PREFIX_PATH ${Trilinos_PREFIX} ${CMAKE_PREFIX_PATH}) # Get Trilinos as one entity FIND_PACKAGE(Trilinos REQUIRED) # Echo trilinos build info just for fun MESSAGE("\nFound Trilinos! Here are the details: ") MESSAGE(" Trilinos_DIR = ${Trilinos_DIR}") MESSAGE(" Trilinos_VERSION = ${Trilinos_VERSION}") MESSAGE(" Trilinos_PACKAGE_LIST = ${Trilinos_PACKAGE_LIST}") MESSAGE(" Trilinos_LIBRARIES = ${Trilinos_LIBRARIES}") MESSAGE(" Trilinos_INCLUDE_DIRS = ${Trilinos_INCLUDE_DIRS}") MESSAGE(" Trilinos_LIBRARY_DIRS = ${Trilinos_LIBRARY_DIRS}") MESSAGE(" Trilinos_TPL_LIST = ${Trilinos_TPL_LIST}") MESSAGE(" Trilinos_TPL_INCLUDE_DIRS = ${Trilinos_TPL_INCLUDE_DIRS}") MESSAGE(" Trilinos_TPL_LIBRARIES = ${Trilinos_TPL_LIBRARIES}") MESSAGE(" Trilinos_TPL_LIBRARY_DIRS = ${Trilinos_TPL_LIBRARY_DIRS}") MESSAGE(" Trilinos_BUILD_SHARED_LIBS = ${Trilinos_BUILD_SHARED_LIBS}") MESSAGE(" Trilinos_CXX_COMPILER = ${Trilinos_CXX_COMPILER}") MESSAGE(" Trilinos_C_COMPILER = ${Trilinos_C_COMPILER}") MESSAGE(" Trilinos_Fortran_COMPILER = ${Trilinos_Fortran_COMPILER}") MESSAGE(" Trilinos_CXX_COMPILER_FLAGS = ${Trilinos_CXX_COMPILER_FLAGS}") MESSAGE(" Trilinos_C_COMPILER_FLAGS = ${Trilinos_C_COMPILER_FLAGS}") MESSAGE(" Trilinos_Fortran_COMPILER_FLAGS = ${Trilinos_Fortran_COMPILER_FLAGS}") MESSAGE(" Trilinos_EXTRA_LD_FLAGS = ${Trilinos_EXTRA_LD_FLAGS}") MESSAGE("End of Trilinos details\n") # Make sure to use same compilers and flags as Trilinos SET(CMAKE_CXX_COMPILER ${Trilinos_CXX_COMPILER} ) SET(CMAKE_C_COMPILER ${Trilinos_C_COMPILER} ) SET(CMAKE_Fortran_COMPILER ${Trilinos_Fortran_COMPILER} ) #For older versions of Trilinos #SET(CMAKE_CXX_FLAGS "${Trilinos_CXX_COMPILER_FLAGS} ${CMAKE_CXX_FLAGS} --remove-duplicate-link-files") #For Trilinos versions after the merge of PR#10614 SET(CMAKE_CXX_FLAGS "${Trilinos_CXX_COMPILER_FLAGS} ${CMAKE_CXX_FLAGS}") SET(CMAKE_C_FLAGS "${Trilinos_C_COMPILER_FLAGS} ${CMAKE_C_FLAGS}") SET(CMAKE_Fortran_FLAGS "${Trilinos_Fortran_COMPILER_FLAGS} ${CMAKE_Fortran_FLAGS}") # # End of setup and error checking # NOTE: PROJECT command checks for compilers, so this statement # is moved AFTER setting CMAKE_CXX_COMPILER from Trilinos PROJECT(my_Adelus_driver C CXX) ADD_DEFINITIONS(-DKKVIEW_API) TRIBITS_INCLUDE_DIRECTORIES(${Trilinos_INCLUDE_DIRS} ${Trilinos_TPL_INCLUDE_DIRS}) LINK_DIRECTORIES(${Trilinos_LIBRARY_DIRS} ${Trilinos_TPL_LIBRARY_DIRS}) ADD_EXECUTABLE(adelus_driver adelus_driver.cpp) set_property(TARGET adelus_driver PROPERTY CXX_STANDARD 14) #For older versions of Trilinos #TARGET_LINK_LIBRARIES(adelus_driver ${Trilinos_LIBRARIES} ${Trilinos_TPL_LIBRARIES} ${Trilinos_EXTRA_LD_FLAGS}) #For Trilinos versions after the merge of PR#10614 TARGET_LINK_LIBRARIES(adelus_driver Trilinos::all_selected_libs)