Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
amdis-core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
amdis
amdis-core
Commits
f6a1b8c9
Commit
f6a1b8c9
authored
1 year ago
by
Praetorius, Simon
Browse files
Options
Downloads
Patches
Plain Diff
Improve the FindPETSc module
parent
d0a5e532
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
cmake/modules/FindPETSc.cmake
+27
-24
27 additions, 24 deletions
cmake/modules/FindPETSc.cmake
with
27 additions
and
24 deletions
cmake/modules/FindPETSc.cmake
+
27
−
24
View file @
f6a1b8c9
...
...
@@ -13,9 +13,9 @@
#
# Author: Simon Praetorius <simon.praetorius@tu-dresden.de>
in
clude
(
Find
PkgConfig
)
f
in
d_package
(
PkgConfig
)
if
(
NOT P
KG_CONFIG
_FOUND
)
if
(
NOT P
kgConfig
_FOUND
)
message
(
FATAL_ERROR
"Can not find PkgConfig!"
)
endif
()
...
...
@@ -47,42 +47,45 @@ else ()
endif
()
if
(
PETSC_STATIC_FOUND
)
set
(
_prefix
PETSC_STATIC
)
set
(
PETSc_VERSION
"
${
PETSC_STATIC
_VERSION
}
"
)
elseif
(
PETSC_FOUND
)
set
(
_prefix PETSC
)
set
(
PETSc_VERSION
"
${
PETSC_VERSION
}
"
)
endif
()
set
(
PETSc_VERSION
"
${${
_prefix
}
_VERSION
}
"
)
if
((
PETSC_STATIC_FOUND OR PETSC_FOUND
)
AND NOT TARGET PETSc::PETSc
)
add_library
(
PETSc::PETSc INTERFACE IMPORTED GLOBAL
)
if
(
${
_prefix
}
_INCLUDE_DIRS
)
set_property
(
TARGET PETSc::PETSc PROPERTY
INTERFACE_INCLUDE_DIRECTORIES
"
${${
_prefix
}
_INCLUDE_DIRS
}
"
)
if
(
PETSC_INCLUDE_DIRS
)
set_property
(
TARGET PETSc::PETSc PROPERTY INTERFACE_INCLUDE_DIRECTORIES
"
${
PETSC_INCLUDE_DIRS
}
"
)
endif
()
i
f
(
${
_prefix
}
_LINK_LIBRARIES
)
set_property
(
TARGET PETSc::PETSc PROPERTY
INTERFACE_LINK_LIBRARIES
"
${
${
_prefix
}
_LINK_LIBRARIES
}
"
)
i
nclude
(
PkgConfigLinkLibraries
)
if
(
PETSC_LINK_LIBRARIES
)
set_property
(
TARGET PETSc::PETSc PROPERTY
INTERFACE_LINK_LIBRARIES
"
${
PETSC
_LINK_LIBRARIES
}
"
)
else
()
# extract the absolute paths of link libraries from the LDFLAGS
include
(
PkgConfigLinkLibraries
)
pkg_config_link_libraries
(
${
_prefix
}
_libs
)
set_property
(
TARGET PETSc::PETSc PROPERTY
INTERFACE_LINK_LIBRARIES
"
${
_libs
}
"
)
pkg_config_link_libraries
(
PETSC _libs
)
set_property
(
TARGET PETSc::PETSc PROPERTY INTERFACE_LINK_LIBRARIES
"
${
_libs
}
"
)
unset
(
_libs
)
endif
()
if
(
${
_prefix
}
_LDFLAGS_OTHER
)
set_property
(
TARGET PETSc::PETSc PROPERTY
INTERFACE_LINK_OPTIONS
"
${${
_prefix
}
_LDFLAGS_OTHER
}
"
)
if
(
PETSC_STATIC_LINK_LIBRARIES
)
set_property
(
TARGET PETSc::PETSc PROPERTY INTERFACE_LINK_LIBRARIES
"
${
PETSC_STATIC_LINK_LIBRARIES
}
"
)
else
()
# extract the absolute paths of link libraries from the LDFLAGS
pkg_config_link_libraries
(
PETSC_STATIC _static_libs
)
set_property
(
TARGET PETSc::PETSc PROPERTY INTERFACE_LINK_LIBRARIES
"
${
_static_libs
}
"
)
unset
(
_static_libs
)
endif
()
if
(
PETSC_LDFLAGS_OTHER
)
set_property
(
TARGET PETSc::PETSc PROPERTY INTERFACE_LINK_OPTIONS
"
${
PETSC_LDFLAGS_OTHER
}
"
)
endif
()
if
(
PETSC_STATIC_LDFLAGS_OTHER
)
set_property
(
TARGET PETSc::PETSc PROPERTY INTERFACE_LINK_OPTIONS
"
${
PETSC_STATIC_LDFLAGS_OTHER
}
"
)
endif
()
if
(
${
_prefix
}
_CFLAGS_OTHER
)
set_property
(
TARGET PETSc::PETSc PROPERTY
INTERFACE_COMPILE_OPTIONS
"
${${
_prefix
}
_CFLAGS_OTHER
}
"
)
if
(
PETSC_CFLAGS_OTHER
)
set_property
(
TARGET PETSc::PETSc PROPERTY INTERFACE_COMPILE_OPTIONS
"
${
PETSC_CFLAGS_OTHER
}
"
)
endif
()
# workaround for PETSc macros redefining MPI functions
set_property
(
TARGET PETSc::PETSc PROPERTY
INTERFACE_COMPILE_DEFINITIONS
"PETSC_HAVE_BROKEN_RECURSIVE_MACRO=1"
)
set_property
(
TARGET PETSc::PETSc PROPERTY INTERFACE_COMPILE_DEFINITIONS
"PETSC_HAVE_BROKEN_RECURSIVE_MACRO=1"
)
endif
()
unset
(
_prefix
)
include
(
FindPackageHandleStandardArgs
)
find_package_handle_standard_args
(
PETSc
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment