Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMake: Do not compile/use included "getopt" if OS has native implementation. #163

Merged
merged 2 commits into from
Oct 30, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,13 @@ set_property(GLOBAL PROPERTY USE_FOLDERS ON)

# Source groups

file(GLOB SOURCE_FILES *.c)
set(SOURCE_FILES
jpegoptim.c
jpegsrc.c
jpegdest.c
jpegmarker.c
misc.c
)
source_group("Source Files" FILES ${SOURCE_FILES})


Expand Down Expand Up @@ -146,9 +152,9 @@ endif()

# Include directories

target_include_directories(${PROJECT_NAME} PUBLIC
"${CMAKE_CURRENT_SOURCE_DIR}"
)
#target_include_directories(${PROJECT_NAME} PUBLIC
# "${CMAKE_CURRENT_SOURCE_DIR}"
#)


# Compile definitions
Expand Down Expand Up @@ -280,6 +286,12 @@ target_compile_definitions(${PROJECT_NAME} PRIVATE
)


# Include getopt only if no native implementation found.
if(NOT HAVE_GETOPT_LONG)
target_sources(${PROJECT_NAME} PRIVATE getopt.c getopt1.c)
endif()


# Attach a manifest file to support UTF-8 on compatible Windows systems (see https://learn.microsoft.com/en-us/windows/apps/design/globalizing/use-utf8-code-page)

if(MSVC)
Expand Down
Loading