Commit d19125f8 authored by PRUVOST Florent's avatar PRUVOST Florent
Browse files

Add a <PACKAGE>_C_FLAGS variable to give CFLAGS such as definitions to users

parent e8c24ef3
......@@ -37,6 +37,7 @@
# This module finds headers and chameleon library.
# Results are reported in variables:
# CHAMELEON_FOUND - True if headers and requested libraries were found
# CHAMELEON_C_FLAGS - list of required compilation flags (excluding -I)
# CHAMELEON_LINKER_FLAGS - list of required linker flags (excluding -l and -L)
# CHAMELEON_INCLUDE_DIRS - chameleon include directories
# CHAMELEON_LIBRARY_DIRS - Link directories for chameleon libraries
......@@ -166,6 +167,7 @@ if(PKG_CONFIG_EXECUTABLE AND NOT CHAMELEON_GIVEN_BY_USER)
endif()
endif()
set(CHAMELEON_C_FLAGS "${CHAMELEON_CFLAGS_OTHER}")
set(CHAMELEON_INCLUDE_DIRS_DEP "${CHAMELEON_STATIC_INCLUDE_DIRS}")
set(CHAMELEON_LIBRARY_DIRS_DEP "${CHAMELEON_STATIC_LIBRARY_DIRS}")
set(CHAMELEON_LIBRARIES_DEP "${CHAMELEON_STATIC_LIBRARIES}")
......
......@@ -20,6 +20,7 @@
# This module finds headers and eztrace library.
# Results are reported in variables:
# EZTRACE_FOUND - True if headers and requested libraries were found
# EZTRACE_C_FLAGS - list of required compilation flags (excluding -I)
# EZTRACE_INCLUDE_DIRS - eztrace include directories
# EZTRACE_LIBRARY_DIRS - Link directories for eztrace libraries
# EZTRACE_LIBRARIES - eztrace component libraries to be linked
......@@ -86,6 +87,8 @@ if( PKG_CONFIG_EXECUTABLE AND NOT EZTRACE_GIVEN_BY_USER )
endif()
endif()
set(EZTRACE_C_FLAGS "${EZTRACE_CFLAGS_OTHER}")
endif( PKG_CONFIG_EXECUTABLE AND NOT EZTRACE_GIVEN_BY_USER )
if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT EZTRACE_FOUND) OR (EZTRACE_GIVEN_BY_USER) )
......
......@@ -230,6 +230,7 @@ if (NOT FFTW_LOOK_FOR_MKL AND NOT FFTW_LOOK_FOR_ESSL)
pkg_search_module(FFTW3F fftw3f)
pkg_search_module(FFTW3 fftw3)
if (FFTW3F_FOUND)
set(FFTW_C_FLAGS "${FFTW3F_CFLAGS_OTHER}")
if (NOT FFTW_FIND_QUIETLY)
message(STATUS "Looking for FFTW3F - found using PkgConfig")
endif()
......@@ -259,6 +260,7 @@ if (NOT FFTW_LOOK_FOR_MKL AND NOT FFTW_LOOK_FOR_ESSL)
pkg_search_module(FFTW3L fftw3l)
pkg_search_module(FFTW3 fftw3)
if (FFTW3L_FOUND)
set(FFTW_C_FLAGS "${FFTW3L_CFLAGS_OTHER}")
if (NOT FFTW_FIND_QUIETLY)
message(STATUS "Looking for FFTW3L - found using PkgConfig")
endif()
......@@ -288,6 +290,7 @@ if (NOT FFTW_LOOK_FOR_MKL AND NOT FFTW_LOOK_FOR_ESSL)
pkg_search_module(FFTW3Q fftw3q)
pkg_search_module(FFTW3 fftw3)
if (FFTW3Q_FOUND)
set(FFTW_C_FLAGS "${FFTW3Q_CFLAGS_OTHER}")
if (NOT FFTW_FIND_QUIETLY)
message(STATUS "Looking for FFTW3Q - found using PkgConfig")
endif()
......@@ -317,6 +320,7 @@ if (NOT FFTW_LOOK_FOR_MKL AND NOT FFTW_LOOK_FOR_ESSL)
pkg_search_module(FFTW3 fftw3)
endif()
if (FFTW3_FOUND)
set(FFTW_C_FLAGS "${FFTW3_CFLAGS_OTHER}")
if (NOT FFTW_FIND_QUIETLY)
message(STATUS "Looking for FFTW3 - found using PkgConfig")
endif()
......@@ -324,7 +328,7 @@ if (NOT FFTW_LOOK_FOR_MKL AND NOT FFTW_LOOK_FOR_ESSL)
list(APPEND FFTW_LIBRARIES "${FFTW3_LIBRARIES}")
endif()
if(FFTW3_INCLUDE_DIRS)
list(APPEND FFTW_INCLUDE_DIRS "${FFTW3_INCLUDE_DIRS}")
list(APPEND FFTW_INCLUDE_DIRS "${FFTW3_INCLUDE_DIRS}")
else()
if (NOT FFTW_FIND_QUIETLY)
message(WARNING "FFTW3_INCLUDE_DIRS is empty using PkgConfig."
......@@ -333,7 +337,7 @@ if (NOT FFTW_LOOK_FOR_MKL AND NOT FFTW_LOOK_FOR_ESSL)
endif()
endif()
if(FFTW3_LIBRARY_DIRS)
list(APPEND FFTW_LIBRARY_DIRS "${FFTW3_LIBRARY_DIRS}")
list(APPEND FFTW_LIBRARY_DIRS "${FFTW3_LIBRARY_DIRS}")
endif()
else(FFTW3_FOUND)
if (NOT FFTW_FIND_QUIETLY)
......
......@@ -16,6 +16,7 @@
# This module finds headers and fxt library.
# Results are reported in variables:
# FXT_FOUND - True if headers and requested libraries were found
# FXT_C_FLAGS - list of required compilation flags (excluding -I)
# FXT_INCLUDE_DIRS - fxt include directories
# FXT_LIBRARY_DIRS - Link directories for fxt libraries
# FXT_LIBRARIES - fxt component libraries to be linked
......@@ -82,6 +83,8 @@ if(PKG_CONFIG_EXECUTABLE AND NOT FXT_GIVEN_BY_USER)
endif()
endif()
set(FXT_C_FLAGS "${FXT_CFLAGS_OTHER}")
endif(PKG_CONFIG_EXECUTABLE AND NOT FXT_GIVEN_BY_USER)
if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT FXT_FOUND) OR (FXT_GIVEN_BY_USER) )
......
......@@ -16,6 +16,7 @@
# This module finds headers and gtg library.
# Results are reported in variables:
# GTG_FOUND - True if headers and requested libraries were found
# GTG_C_FLAGS - list of required compilation flags (excluding -I)
# GTG_INCLUDE_DIRS - gtg include directories
# GTG_LIBRARY_DIRS - Link directories for gtg libraries
# GTG_LIBRARIES - gtg component libraries to be linked
......@@ -82,6 +83,8 @@ if(PKG_CONFIG_EXECUTABLE AND NOT GTG_GIVEN_BY_USER)
endif()
endif()
set(GTG_C_FLAGS "${GTG_CFLAGS_OTHER}")
endif(PKG_CONFIG_EXECUTABLE AND NOT GTG_GIVEN_BY_USER)
if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT GTG_FOUND) OR (GTG_GIVEN_BY_USER) )
......
......@@ -16,6 +16,7 @@
# This module finds headers and hwloc library.
# Results are reported in variables:
# HWLOC_FOUND - True if headers and requested libraries were found
# HWLOC_C_FLAGS - list of required compilation flags (excluding -I)
# HWLOC_INCLUDE_DIRS - hwloc include directories
# HWLOC_LIBRARY_DIRS - Link directories for hwloc libraries
# HWLOC_LIBRARIES - hwloc component libraries to be linked
......@@ -85,6 +86,8 @@ if( PKG_CONFIG_EXECUTABLE AND NOT HWLOC_GIVEN_BY_USER )
endif()
endif()
set(HWLOC_C_FLAGS "${HWLOC_CFLAGS_OTHER}")
endif( PKG_CONFIG_EXECUTABLE AND NOT HWLOC_GIVEN_BY_USER )
if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT HWLOC_FOUND) OR (HWLOC_GIVEN_BY_USER) )
......
......@@ -27,6 +27,7 @@
#
# Results are reported in variables:
# MAGMA_FOUND - True if headers and requested libraries were found
# MAGMA_C_FLAGS - list of required compilation flags (excluding -I)
# MAGMA_LINKER_FLAGS - list of required linker flags (excluding -l and -L)
# MAGMA_INCLUDE_DIRS - magma include directories
# MAGMA_LIBRARY_DIRS - Link directories for magma libraries
......@@ -162,6 +163,7 @@ if(PKG_CONFIG_EXECUTABLE AND NOT MAGMA_GIVEN_BY_USER)
set(MAGMA_INCLUDE_DIRS_DEP "${MAGMA_STATIC_INCLUDE_DIRS}")
set(MAGMA_LIBRARY_DIRS_DEP "${MAGMA_STATIC_LIBRARY_DIRS}")
set(MAGMA_LIBRARIES_DEP "${MAGMA_STATIC_LIBRARIES}")
set(MAGMA_C_FLAGS "${MAGMA_CFLAGS_OTHER}")
endif(PKG_CONFIG_EXECUTABLE AND NOT MAGMA_GIVEN_BY_USER)
......
......@@ -16,6 +16,7 @@
# This module finds headers and papi library.
# Results are reported in variables:
# PAPI_FOUND - True if headers and requested libraries were found
# PAPI_C_FLAGS - list of required compilation flags (excluding -I)
# PAPI_INCLUDE_DIRS - papi include directories
# PAPI_LIBRARY_DIRS - Link directories for papi libraries
# PAPI_LIBRARIES - papi component libraries to be linked
......@@ -82,6 +83,8 @@ if(PKG_CONFIG_EXECUTABLE AND NOT PAPI_GIVEN_BY_USER)
endif()
endif()
set(PAPI_C_FLAGS "${PAPI_CFLAGS_OTHER}")
endif(PKG_CONFIG_EXECUTABLE AND NOT PAPI_GIVEN_BY_USER)
if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT PAPI_FOUND) OR (PAPI_GIVEN_BY_USER) )
......
......@@ -239,6 +239,7 @@ if(PKG_CONFIG_EXECUTABLE AND NOT PARSEC_GIVEN_BY_USER)
set(PARSEC_INCLUDE_DIRS_DEP "${PARSEC_INCLUDE_DIRS}")
set(PARSEC_LIBRARY_DIRS_DEP "${PARSEC_LIBRARY_DIRS}")
set(PARSEC_LIBRARIES_DEP "${PARSEC_LIBRARIES}")
set(PARSEC_C_FLAGS "${PARSEC_CFLAGS_OTHER}")
# create list of binaries to find
set(PARSEC_bins_to_find "parsec_ptgpp")
......
......@@ -16,6 +16,7 @@
# This module finds headers and simgrid library.
# Results are reported in variables:
# SIMGRID_FOUND - True if headers and requested libraries were found
# SIMGRID_C_FLAGS - list of required compilation flags (excluding -I)
# SIMGRID_INCLUDE_DIRS - simgrid include directories
# SIMGRID_LIBRARY_DIRS - Link directories for simgrid libraries
# SIMGRID_LIBRARIES - simgrid component libraries to be linked
......@@ -82,6 +83,8 @@ if(PKG_CONFIG_EXECUTABLE AND NOT SIMGRID_GIVEN_BY_USER)
endif()
endif()
set(SIMGRID_C_FLAGS "${SIMGRID_CFLAGS_OTHER}")
endif(PKG_CONFIG_EXECUTABLE AND NOT SIMGRID_GIVEN_BY_USER)
if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT SIMGRID_FOUND) OR (SIMGRID_GIVEN_BY_USER) )
......
......@@ -275,9 +275,11 @@ if(PKG_CONFIG_EXECUTABLE AND NOT STARPU_GIVEN_BY_USER)
endif()
set(STARPU_LIBRARIES "${STARPU_MPI_STATIC_LIBRARIES}")
set(STARPU_LINKER_FLAGS "${STARPU_MPI_STATIC_LDFLAGS_OTHER}")
set(STARPU_C_FLAGS "${STARPU_MPI_CFLAGS_OTHER}")
elseif(STARPU_SHM_LIBRARIES)
set(STARPU_LIBRARIES "${STARPU_SHM_STATIC_LIBRARIES}")
set(STARPU_LINKER_FLAGS "${STARPU_SHM_STATIC_LDFLAGS_OTHER}")
set(STARPU_C_FLAGS "${STARPU_CFLAGS_OTHER}")
else()
set(STARPU_LIBRARIES "STARPU_LIBRARIES-NOTFOUND")
endif()
......@@ -292,6 +294,7 @@ if(PKG_CONFIG_EXECUTABLE AND NOT STARPU_GIVEN_BY_USER)
if (STARPU_LOOK_FOR_MPI AND NOT STARPU_MPI_FOUND)
set(STARPU_FOUND "FALSE")
endif()
endif(PKG_CONFIG_EXECUTABLE AND NOT STARPU_GIVEN_BY_USER)
......
  • I suppose this is a fix for #3 (closed) ?
    Why not use the word DEFINITIONS?
    Are there cases among the one handled in this commit where this is not appropriate?

    https://cmake.org/Wiki/CMake:How_To_Find_Libraries#How_package_finding_works

    What command should the user use to handle this variable?

    these ones:
    target_compile_definitions()
    add_definitions()

    or these ones:
    target_compile_options()
    add_compile_options()

    ?

    • not completely a fix because for the packages that do not rely on pkg-config we need to write something specific depending on the package
    • the needs for some specific definitions in some modules should be handled on the fly
    • but yes we can close the issue #3 (closed) if it's fine with you
    • not DEFINITIONS because it may contain other flags and because C_FLAGS was already introduced in some other modules, for the sake of consistency ...
    • the compile I guess since the C_FLAGS may contain additional flags other than defs
    Edited by PRUVOST Florent
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment