cmake: tidy-ups

- tidy-up comments.
- use lowercase, underscore prefixed names for internal variables.
- use `IN LISTS` and `IN ITEMS` in `foreach()` loops.
- rename variable name `OUTPUT` to a more distinctive one.
- tidy-up `STREQUAL` syntax.
- delete commented code.
- indent/whitespace.

Closes #14197
This commit is contained in:
Viktor Szakats 2024-07-12 21:10:57 +02:00
parent b64d9d7d81
commit acbc6b703f
No known key found for this signature in database
GPG key ID: B5ABD165E2AEF201
26 changed files with 401 additions and 487 deletions

View file

@ -24,7 +24,7 @@
set(MANPAGE "${CURL_BINARY_DIR}/docs/cmdline-opts/curl.1")
set(ASCIIPAGE "${CURL_BINARY_DIR}/docs/cmdline-opts/curl.txt")
# Load DPAGES and OTHERPAGES from shared file
# Get 'DPAGES' variable
transform_makefile_inc("Makefile.inc" "${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake")
include("${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake")

View file

@ -22,23 +22,23 @@
#
###########################################################################
# Get 'check_PROGRAMS' variable
transform_makefile_inc("Makefile.inc"
"${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake")
include(${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake)
# Get 'check_PROGRAMS' variable
foreach(example IN LISTS check_PROGRAMS)
set(example_target "curl-example-${example}")
add_executable(${example_target} "${example}.c")
target_include_directories(${example_target} PRIVATE
foreach(_example IN LISTS check_PROGRAMS)
set(_example_target "curl-example-${_example}")
add_executable(${_example_target} "${_example}.c")
target_include_directories(${_example_target} PRIVATE
"${CURL_SOURCE_DIR}/lib" # for "curl_setup_once.h"
"${CURL_BINARY_DIR}/lib" # for "curl_config.h"
"${CURL_BINARY_DIR}/include" # for "curl/curl.h"
)
target_link_libraries(${example_target} ${LIB_SELECTED} ${CURL_LIBS})
target_compile_definitions(${example_target} PRIVATE "CURL_NO_OLDIES")
target_link_libraries(${_example_target} ${LIB_SELECTED} ${CURL_LIBS})
target_compile_definitions(${_example_target} PRIVATE "CURL_NO_OLDIES")
if(LIB_SELECTED STREQUAL LIB_STATIC AND WIN32)
set_property(TARGET ${example_target} APPEND PROPERTY COMPILE_DEFINITIONS "CURL_STATICLIB")
set_property(TARGET ${_example_target} APPEND PROPERTY COMPILE_DEFINITIONS "CURL_STATICLIB")
endif()
set_target_properties(${example_target} PROPERTIES OUTPUT_NAME "${example}" UNITY_BUILD OFF)
set_target_properties(${_example_target} PROPERTIES OUTPUT_NAME "${_example}" UNITY_BUILD OFF)
endforeach()

View file

@ -21,7 +21,7 @@
# SPDX-License-Identifier: curl
#
###########################################################################
# Load man_MANS from shared file
# Get 'man_MANS' variable
transform_makefile_inc("Makefile.inc" "${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake")
include("${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake")
@ -76,7 +76,7 @@ add_manual_pages(man_MANS)
add_custom_target(curl-man ALL DEPENDS ${man_MANS})
if(NOT CURL_DISABLE_INSTALL)
unset(_src)
foreach(_f ${man_MANS})
foreach(_f IN LISTS man_MANS)
list(APPEND _src "${CMAKE_CURRENT_BINARY_DIR}/${_f}")
endforeach()
install(FILES ${_src} DESTINATION ${CMAKE_INSTALL_MANDIR}/man3)

View file

@ -21,7 +21,7 @@
# SPDX-License-Identifier: curl
#
###########################################################################
# Load man_MANS from shared file
# Get 'man_MANS' variable
transform_makefile_inc("Makefile.inc" "${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake")
include("${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake")
@ -30,7 +30,7 @@ add_custom_target(curl-opts-man DEPENDS ${man_MANS})
add_dependencies(curl-man curl-opts-man)
if(NOT CURL_DISABLE_INSTALL)
unset(_src)
foreach(_f ${man_MANS})
foreach(_f IN LISTS man_MANS)
list(APPEND _src "${CMAKE_CURRENT_BINARY_DIR}/${_f}")
endforeach()
install(FILES ${_src} DESTINATION ${CMAKE_INSTALL_MANDIR}/man3)