xref: /phasta/phSolver/incompressible/CMakeLists.txt (revision 50a6f6340c649c1738186cf6fd8c42a882135a5f)
1file(GLOB SRC_FILES *.cc *.f *.f90 *.c)
2list(REMOVE_ITEM SRC_FILES "main.cc")
3add_library(incompressible ${SRC_FILES})
4
5find_package(phastaCommon REQUIRED PATHS ${CMAKE_BINARY_DIR})
6set(PHASTAIC_LIBS ${CMAKE_THREAD_LIBS_INIT} ${PHASTA_COMMON_LIBS})
7set(PHASTAIC_INCLUDE_DIRS
8  ${PHASTAIC_INCLUDE_DIRS}
9  ${PHASTA_COMMON_INCLUDE_DIRS}
10  ${PHASTA_BINARY_DIR}
11)
12
13add_executable(phastaIC.exe main.cc)
14include_directories(${PHASTAIC_INCLUDE_DIRS})
15set_target_properties(phastaIC.exe PROPERTIES HAS_CXX TRUE)
16set_target_properties(incompressible PROPERTIES HAS_CXX TRUE)
17set_target_properties(phastaIC.exe PROPERTIES LINKER_LANGUAGE Fortran)
18set_target_properties(incompressible PROPERTIES LINKER_LANGUAGE Fortran)
19if(CMAKE_Fortran_COMPILER_ID MATCHES XL)
20	#force preprocessing of solfar.f
21	set_source_files_properties(solfar.f PROPERTIES COMPILE_FLAGS "-qsuffix=cpp=f")
22	set_source_files_properties(itrdrv.f PROPERTIES COMPILE_FLAGS "-qsuffix=cpp=f")
23endif(CMAKE_Fortran_COMPILER_ID MATCHES XL)
24if(CMAKE_Fortran_COMPILER_ID MATCHES PGI)
25	#force preprocessing of solfar.f
26	set_source_files_properties(solfar.f PROPERTIES COMPILE_FLAGS "-Mpreprocess")
27endif(CMAKE_Fortran_COMPILER_ID MATCHES PGI)
28#incompressible reuses a fortran module from common w/o telling cmake
29#this is why we specify a module directory in the next cmakelists up
30#and we need to serialize incompressible after common
31add_dependencies(incompressible common)
32find_library(ACUSOLVE_LIB libles)
33#ughhh
34set(PHASTAIC_LIBS
35  ${PHASTA_COMMON_LIBS}
36  incompressible
37  ${ACUSOLVE_LIB}
38  svLS
39  incompressible
40  ${PHASTA_COMMON_LIBS}
41)
42set(PHASTAIC_LIBS ${PHASTAIC_LIBS} phastaIO)
43if(PHASTA_BUILD_SHAPEFUNCTION)
44  set(PHASTAIC_LIBS ${PHASTAIC_LIBS} shapeFunction)
45endif(PHASTA_BUILD_SHAPEFUNCTION)
46if(PHASTA_BUILD_PHSHAPE)
47  set(PHASTAIC_LIBS ${PHASTAIC_LIBS} phshape)
48endif(PHASTA_BUILD_PHSHAPE)
49target_link_libraries(phastaIC.exe ${PHASTAIC_LIBS})
50if(PHASTA_USE_PETSC)
51	#target_link_libraries(phastaC.exe ${PETSC_LIB}/libpetsc.a ${PETSC_PACKAGE_LIBS})
52	target_link_libraries(phastaIC.exe petsc ${PETSC_PACKAGE_LIBS} ${PHASTAIC_LIBS})
53endif()
54configure_file(
55  "${CMAKE_CURRENT_SOURCE_DIR}/phastaICConfig.cmake.in"
56  "${CMAKE_BINARY_DIR}/phastaICConfig.cmake"
57)
58
59if(PHASTA_TESTING)
60  add_subdirectory(test)
61endif(PHASTA_TESTING)
62