Skip to content

Commit

Permalink
Removing CMAKD_CXX_FLAGS settings, and replacing them with add_defini…
Browse files Browse the repository at this point in the history
…tions and add_compile_options.
  • Loading branch information
aous72 committed Dec 30, 2023
1 parent 0de48e2 commit 3d8f5c8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 19 deletions.
24 changes: 11 additions & 13 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,30 +49,28 @@ include(ojph_libname.cmake)
## C++ version and flags
set(CMAKE_CXX_STANDARD 14)
if (MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc /D \"_CRT_SECURE_NO_WARNINGS\"")
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
endif()
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang|GNU")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fexceptions -Wall -Wextra -Wconversion -Wunused-parameter")
add_compile_options(
-fexceptions
-Wall
-Wextra
-Wconversion
-Wunused-parameter
)
endif()

## The option OJPH_DISABLE_INTEL_SIMD and OJPH_ENABLE_INTEL_AVX512
if (OJPH_DISABLE_INTEL_SIMD)
if (MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /D \"OJPH_DISABLE_INTEL_SIMD\"")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DOJPH_DISABLE_INTEL_SIMD")
endif()
add_definitions(-DOJPH_DISABLE_INTEL_SIMD)
elseif (OJPH_ENABLE_INTEL_AVX512)
if (MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /D \"OJPH_ENABLE_INTEL_AVX512\"")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DOJPH_ENABLE_INTEL_AVX512")
endif()
add_definitions(-DOJPH_ENABLE_INTEL_AVX512)
endif()

## The option BUILD_SHARED_LIBS
if (BUILD_SHARED_LIBS AND MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /D \"OJPH_BUILD_SHARED_LIBRARY\"")
add_definitions(-DOJPH_BUILD_SHARED_LIBRARY)
endif()

## specify output directories
Expand Down
7 changes: 1 addition & 6 deletions src/apps/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,7 @@ if( OJPH_ENABLE_TIFF_SUPPORT )
if( TIFF_FOUND )
set(USE_TIFF TRUE CACHE BOOL "Add TIFF support")
include_directories( ${TIFF_INCLUDE_DIR} )
if (MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /D \"OJPH_ENABLE_TIFF_SUPPORT\"")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DOJPH_ENABLE_TIFF_SUPPORT")
endif()
#include_directories(${CMAKE_BINARY_DIR}/libtiff) # for tiffconf.h on windows
add_definitions(-DOJPH_ENABLE_TIFF_SUPPORT)
endif( TIFF_FOUND )

endif()
Expand Down

0 comments on commit 3d8f5c8

Please sign in to comment.