cmake: JPEG imported target is >=cmake-3.12 only

This commit is contained in:
Christoph Junghans 2020-03-23 08:23:16 -06:00
parent 6ee25db32a
commit 9b8266173f
1 changed files with 6 additions and 1 deletions

View File

@ -284,7 +284,12 @@ option(WITH_JPEG "Enable JPEG support" ${JPEG_FOUND})
if(WITH_JPEG)
find_package(JPEG REQUIRED)
add_definitions(-DLAMMPS_JPEG)
target_link_libraries(lammps PRIVATE JPEG::JPEG)
if(CMAKE_VERSION VERSION_LESS 3.12)
include_directories(${JPEG_INCLUDE_DIR})
target_link_libraries(lammps PRIVATE ${JPEG_LIBRARIES})
else()
target_link_libraries(lammps PRIVATE JPEG::JPEG)
endif()
endif()
find_package(PNG QUIET)