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

Update src/CMakeLists.txt #1569

Merged
merged 1 commit into from
Nov 22, 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
22 changes: 13 additions & 9 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,14 @@ endif()
include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR})
add_compile_definitions(CONFIG_DIR=\"${CONFIG_DIR}\")

set(EXTRA_WINDOWS_SOURCES)
set(EXTRA_WINDOWS_INCLUDES)
set(EXTRA_WINDOWS_RESOURCES)
set(EXTRA_WINDOWS_LIBRARIES)

if(WIN32 OR MINGW)
set(EXTRA_WINDOWS_RESOURCES "${PROJECT_BINARY_DIR}/src/windows.rc")
set(EXTRA_WINDOWS_LIBRARIES setupapi hid ws2_32)
list(APPEND EXTRA_WINDOWS_RESOURCES "${PROJECT_BINARY_DIR}/src/windows.rc")
list(APPEND EXTRA_WINDOWS_LIBRARIES setupapi hid ws2_32)
endif()

if(MSVC)
Expand All @@ -66,15 +71,13 @@ if(MSVC)
add_compile_options(/wd4244) # warning C4244: conversion from '...' to '...', possible loss of data
add_compile_options(/wd4267) # warning C4267: conversion from '...' to '...', possible loss of data

set(EXTRA_WINDOWS_SOURCES ${EXTRA_WINDOWS_SOURCES}
list(APPEND EXTRA_WINDOWS_SOURCES
"msvc/getopt.c"
"msvc/gettimeofday.c"
"msvc/usleep.cpp"
"msvc/readline.cpp"
)
set(EXTRA_WINDOWS_INCLUDES ${EXTRA_WINDOWS_INCLUDES}
"msvc"
)
list(APPEND EXTRA_WINDOWS_INCLUDES "msvc")
else()
set(LIB_MATH m)
add_compile_options(-Wall -Wextra -Wno-unused-parameter)
Expand Down Expand Up @@ -260,7 +263,7 @@ add_library(libavrdude
xbee.c
${FLEX_Parser_OUTPUTS}
${BISON_Parser_OUTPUTS}
"${EXTRA_WINDOWS_SOURCES}"
${EXTRA_WINDOWS_SOURCES}
)

set_target_properties(libavrdude PROPERTIES
Expand All @@ -274,8 +277,9 @@ target_include_directories(libavrdude
PUBLIC
"${PROJECT_SOURCE_DIR}"
"${PROJECT_BINARY_DIR}"
"${CMAKE_CURRENT_SOURCE_DIR}"
"${LIBUSB_COMPAT_DIR}"
"${EXTRA_WINDOWS_INCLUDES}"
${EXTRA_WINDOWS_INCLUDES}
)

target_link_libraries(libavrdude
Expand All @@ -302,7 +306,7 @@ add_executable(avrdude
developer_opts_private.h
whereami.c
whereami.h
"${EXTRA_WINDOWS_RESOURCES}"
${EXTRA_WINDOWS_RESOURCES}
)

target_link_libraries(avrdude PUBLIC libavrdude)
Expand Down