Skip to content

Commit

Permalink
moving compile definitions to top-level cmake file (#423)
Browse files Browse the repository at this point in the history
* moving compile definitions to top-level cmake file

* moving compile definitions to top-level cmake file

* fixed JPEG pre-processor symbol for tests

* cmake cleanup

* removed mistaken change

---------

Co-authored-by: Ed <edwardjameshartnett@gmail.com>
  • Loading branch information
edwardhartnett and edhartnett authored Jul 3, 2023
1 parent 5178ca5 commit 7abc8f5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 8 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,11 @@ else()
message(STATUS "Will not build OpenJPEG support")
endif()

# Turn on this pre-processor symbol to get JPEG code and testing.
if(USE_Jasper OR USE_OpenJPEG)
add_definitions(-DJPEG)
endif()

# Find libxml2.
find_package(LibXml2 2.9.0 REQUIRED)

Expand All @@ -101,6 +106,9 @@ elseif(CMAKE_C_COMPILER_ID MATCHES "^(GNU|Clang|AppleClang)$")
set(CMAKE_C_FLAGS_DEBUG "-O0 -ggdb -Wall")
endif()

# Set this to better handle files > 2 GB.
add_compile_definitions(_LARGEFILE64_SOURCE)

set(lib_name ${PROJECT_NAME})

# Build the code in the source directory.
Expand Down
2 changes: 0 additions & 2 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ if(JASPER_FOUND)
message(STATUS " JASPER is version 3.0 or greater")
add_definitions(-DJASPER3)
endif()
add_definitions(-DJPEG)
if(BUILD_SHARED_LIBS)
target_link_libraries(${lib_name}_shared PRIVATE ${JASPER_LIBRARIES})
target_include_directories(${lib_name}_shared PRIVATE "${JASPER_INCLUDE_DIRS}")
Expand All @@ -118,7 +117,6 @@ if(OPENJPEG_FOUND)
target_link_libraries(${lib_name}_objlib PRIVATE ${OpenJPEG_LIBRARIES})
target_include_directories(${lib_name}_objlib PRIVATE "${OpenJPEG_INCLUDE_DIRS}")
set(G2_JPEG2000_ENABLED ON)
add_definitions(-DJPEG)
if(BUILD_SHARED_LIBS)
target_link_libraries(${lib_name}_shared PRIVATE ${OpenJPEG_LIBRARIES})
target_include_directories(${lib_name}_shared PRIVATE "${OpenJPEG_INCLUDE_DIRS}")
Expand Down

0 comments on commit 7abc8f5

Please sign in to comment.