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: add debug options to windows builds #834

Merged
merged 1 commit into from
Apr 6, 2022
Merged
Show file tree
Hide file tree
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
6 changes: 5 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ if (NOT LOG_LEVEL)
endif()

if (MSVC)
add_compile_options(/W4 /wd4200 /wd4127 /wd4100)
add_compile_options(/Zi /W4 /wd4200 /wd4127 /wd4100)
# Zi produces a separate PDB file that contains all the symbolic debugging information
# W4 displays level 1, 2, 3, and 4 (informational) warnings that aren't off by default
# C4200: nonstandard extension used : zero-sized array in struct (usb.h)
# C4127: conditional expression is constant (IIO_ERROR and IIO_DEBUG macros)
# C4100: unreferenced parameter; same as -Wno-unused-parameter
Expand Down Expand Up @@ -474,6 +476,8 @@ target_link_libraries(iio LINK_PRIVATE ${LIBS_TO_LINK})

if (MSVC)
set_target_properties(iio PROPERTIES OUTPUT_NAME libiio)
target_link_options(iio PUBLIC /DEBUG)
# The linker puts debugging information into a program database (PDB) file
endif()

if(NOT SKIP_INSTALL_ALL)
Expand Down
10 changes: 10 additions & 0 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,16 @@ add_executable(iio_readdev iio_readdev.c ${GETOPT_C_FILE} ${LIBIIO_RC})
add_executable(iio_reg iio_reg.c ${GETOPT_C_FILE} ${LIBIIO_RC})
add_executable(iio_writedev iio_writedev.c ${GETOPT_C_FILE} ${LIBIIO_RC})

if (MSVC)
target_link_options(iio_tests_helper PUBLIC /DEBUG)
target_link_options(iio_genxml PUBLIC /DEBUG)
target_link_options(iio_info PUBLIC /DEBUG)
target_link_options(iio_attr PUBLIC /DEBUG)
target_link_options(iio_readdev PUBLIC /DEBUG)
target_link_options(iio_reg PUBLIC /DEBUG)
target_link_options(iio_writedev PUBLIC /DEBUG)
endif()

target_link_libraries(iio_genxml iio iio_tests_helper)
target_link_libraries(iio_info iio iio_tests_helper)
target_link_libraries(iio_attr iio iio_tests_helper)
Expand Down