Merge pull request #2353 from junghans/cmake_clean_up

cmake: consistent usage of find variable
This commit is contained in:
Axel Kohlmeyer 2020-09-09 11:04:13 -04:00 committed by GitHub
commit 790b2693ba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 20 additions and 19 deletions

View File

@ -318,7 +318,7 @@ if(WITH_JPEG)
find_package(JPEG REQUIRED)
target_compile_definitions(lammps PRIVATE -DLAMMPS_JPEG)
if(CMAKE_VERSION VERSION_LESS 3.12)
target_include_directories(lammps PRIVATE ${JPEG_INCLUDE_DIR})
target_include_directories(lammps PRIVATE ${JPEG_INCLUDE_DIRS})
target_link_libraries(lammps PRIVATE ${JPEG_LIBRARIES})
else()
target_link_libraries(lammps PRIVATE JPEG::JPEG)

View File

@ -19,16 +19,16 @@ if(FFT STREQUAL "FFTW3")
find_package(${FFTW} REQUIRED)
target_compile_definitions(lammps PRIVATE -DFFT_FFTW3)
target_link_libraries(lammps PRIVATE ${FFTW}::${FFTW})
if(FFTW3_OMP_LIBRARY OR FFTW3F_OMP_LIBRARY)
if(FFTW3_OMP_LIBRARIES OR FFTW3F_OMP_LIBRARIES)
option(FFT_FFTW_THREADS "Use threaded FFTW library" ON)
else()
option(FFT_FFTW_THREADS "Use threaded FFT library" OFF)
endif()
if(FFT_FFTW_THREADS)
if(FFTW3_OMP_LIBRARY OR FFTW3F_OMP_LIBRARY)
target_compile_definitions(lammps PRIVATE -DFFT_FFTW_THREADS)
target_link_libraries(lammps PRIVATE ${FFTW}::${FFTW}_OMP)
if(FFTW3_OMP_LIBRARIES OR FFTW3F_OMP_LIBRARIES)
target_compile_definitions(lammps PRIVATE -DFFT_FFTW_THREADS)
target_link_libraries(lammps PRIVATE ${FFTW}::${FFTW}_OMP)
else()
message(FATAL_ERROR "Need OpenMP enabled FFTW3 library for FFT_THREADS")
endif()

View File

@ -38,7 +38,7 @@ if(DOWNLOAD_MSCG)
else()
find_package(MSCG)
if(NOT MSCG_FOUND)
message(FATAL_ERROR "MSCG not found, help CMake to find it by setting MSCG_LIBRARY and MSCG_INCLUDE_DIRS, or set DOWNLOAD_MSCG=ON to download it")
message(FATAL_ERROR "MSCG not found, help CMake to find it by setting MSCG_LIBRARY and MSCG_INCLUDE_DIR, or set DOWNLOAD_MSCG=ON to download it")
endif()
target_link_libraries(lammps PRIVATE MSCG::MSCG)
endif()

View File

@ -1,7 +1,7 @@
if(CMAKE_VERSION VERSION_LESS 3.12)
find_package(PythonLibs REQUIRED) # Deprecated since version 3.12
target_include_directories(lammps PRIVATE ${PYTHON_INCLUDE_DIR})
target_link_libraries(lammps PRIVATE ${PYTHON_LIBRARY})
target_include_directories(lammps PRIVATE ${PYTHON_INCLUDE_DIRS})
target_link_libraries(lammps PRIVATE ${PYTHON_LIBRARIES})
else()
find_package(Python REQUIRED COMPONENTS Development)
target_link_libraries(lammps PRIVATE Python::Python)

View File

@ -1,4 +1,5 @@
set(MOLFILE_INCLUDE_DIRS "${LAMMPS_LIB_SOURCE_DIR}/molfile" CACHE STRING "Path to VMD molfile plugin headers")
set(MOLFILE_INCLUDE_DIR "${LAMMPS_LIB_SOURCE_DIR}/molfile" CACHE STRING "Path to VMD molfile plugin headers")
set(MOLFILE_INCLUDE_DIRS "${MOLFILE_INCLUDE_DIR}")
add_library(molfile INTERFACE)
target_include_directories(molfile INTERFACE ${MOLFILE_INCLUDE_DIRS})
# no need to link with -ldl on windows

View File

@ -82,7 +82,7 @@ a '/gz' suffix. There are also styles using the
.. code-block:: bash
-D ZLIB_INCLUDE_DIR=path # path to zlib.h header file
-D ZLIB_LIBRARIES=path # path to libz.a (.so) file
-D ZLIB_LIBRARY=path # path to libz.a (.so) file
Support for Zstandard compression is auto-detected and for that
CMake depends on the `pkg-config
@ -1430,11 +1430,11 @@ USER-MOLFILE package
.. code-block:: bash
-D MOLFILE_INCLUDE_DIRS=path # (optional) path where VMD molfile plugin headers are installed
-D MOLFILE_INCLUDE_DIR=path # (optional) path where VMD molfile plugin headers are installed
-D PKG_USER-MOLFILE=yes
Using ``-D PKG_USER-MOLFILE=yes`` enables the package, and setting
``-D MOLFILE_INCLUDE_DIRS`` allows to provide a custom location for
``-D MOLFILE_INCLUDE_DIR`` allows to provide a custom location for
the molfile plugin header files. These should match the ABI of the
plugin files used, and thus one typically sets them to include
folder of the local VMD installation in use. LAMMPS ships with a

View File

@ -69,12 +69,12 @@ LAMMPS can use them if they are available on your system.
.. code-block:: bash
-D FFTW3_INCLUDE_DIRS=path # path to FFTW3 include files
-D FFTW3_LIBRARIES=path # path to FFTW3 libraries
-D FFTW3_INCLUDE_DIR=path # path to FFTW3 include files
-D FFTW3_LIBRARY=path # path to FFTW3 libraries
-D FFT_FFTW_THREADS=on # enable using threaded FFTW3 libraries
-D MKL_INCLUDE_DIRS=path # ditto for Intel MKL library
-D MKL_INCLUDE_DIR=path # ditto for Intel MKL library
-D FFT_MKL_THREADS=on # enable using threaded FFTs with MKL libraries
-D MKL_LIBRARIES=path
-D MKL_LIBRARY=path # path to MKL libraries
.. tab:: Traditional make
@ -310,11 +310,11 @@ following settings:
.. code-block:: bash
-D JPEG_INCLUDE_DIR=path # path to jpeglib.h header file
-D JPEG_LIBRARIES=path # path to libjpeg.a (.so) file
-D JPEG_LIBRARY=path # path to libjpeg.a (.so) file
-D PNG_INCLUDE_DIR=path # path to png.h header file
-D PNG_LIBRARIES=path # path to libpng.a (.so) file
-D PNG_LIBRARY=path # path to libpng.a (.so) file
-D ZLIB_INCLUDE_DIR=path # path to zlib.h header file
-D ZLIB_LIBRARIES=path # path to libz.a (.so) file
-D ZLIB_LIBRARY=path # path to libz.a (.so) file
-D FFMPEG_EXECUTABLE=path # path to ffmpeg executable
.. tab:: Traditional make