diff --git a/cmake-modules/doxygen_common.cmake b/cmake-modules/doxygen_common.cmake index c68e1c4d7..c1f5eac97 100644 --- a/cmake-modules/doxygen_common.cmake +++ b/cmake-modules/doxygen_common.cmake @@ -31,6 +31,6 @@ function(generate_documentation PROJECT_NAME PROJECT_VERSION) doxygen_add_docs(${PROJECT_NAME}-docs ALL - COMMENT "Generate documentation for ${TARGET_NAME}") + COMMENT "Generate documentation for ${PROJECT_NAME}") endif() -endfunction() \ No newline at end of file +endfunction() diff --git a/sdk/core/azure-core/CMakeLists.txt b/sdk/core/azure-core/CMakeLists.txt index fa13ed4f7..37a16b886 100644 --- a/sdk/core/azure-core/CMakeLists.txt +++ b/sdk/core/azure-core/CMakeLists.txt @@ -2,8 +2,8 @@ # SPDX-License-Identifier: MIT cmake_minimum_required (VERSION 3.13) -set(TARGET_NAME "azure-core") -project(${TARGET_NAME} LANGUAGES CXX) +set(azure-core) +project(azure-core LANGUAGES CXX) set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD_REQUIRED True) @@ -43,38 +43,43 @@ endif() include(CodeCoverage) add_library ( - ${TARGET_NAME} - src/context.cpp - src/credentials.cpp - src/datetime.cpp - src/http/body_stream.cpp - ${CURL_TRANSPORT_ADAPTER_SRC} - src/http/http.cpp - src/http/logging_policy.cpp - src/http/policy.cpp - src/http/raw_response.cpp - src/http/request.cpp - src/http/retry_policy.cpp - src/http/telemetry_policy.cpp - src/http/transport_policy.cpp - src/http/url.cpp - ${BUILD_WIN_TRANSPORT} - src/logging/logging.cpp - src/strings.cpp - src/version.cpp - ) + azure-core + src/context.cpp + src/credentials.cpp + src/datetime.cpp + src/http/body_stream.cpp + ${CURL_TRANSPORT_ADAPTER_SRC} + src/http/http.cpp + src/http/logging_policy.cpp + src/http/policy.cpp + src/http/raw_response.cpp + src/http/request.cpp + src/http/retry_policy.cpp + src/http/telemetry_policy.cpp + src/http/transport_policy.cpp + src/http/url.cpp + ${BUILD_WIN_TRANSPORT} + src/logging/logging.cpp + src/strings.cpp + src/version.cpp +) -target_include_directories (${TARGET_NAME} PUBLIC $ $) +target_include_directories( + azure-core + PUBLIC + $ + $ +) # make sure that users can consume the project as a library. -add_library (Azure::Core ALIAS ${TARGET_NAME}) +add_library (Azure::Core ALIAS azure-core) # coverage. Has no effect if BUILD_CODE_COVERAGE is OFF -create_code_coverage(core ${TARGET_NAME} "${TARGET_NAME}-test") +create_code_coverage(core azure-core azure-core-test) -target_include_directories(${TARGET_NAME} PUBLIC ${CURL_INCLUDE_DIRS}) -target_link_libraries(${TARGET_NAME} PRIVATE CURL::libcurl Threads::Threads) -target_link_libraries(${TARGET_NAME} INTERFACE nlohmann_json::nlohmann_json) +target_include_directories(azure-core PUBLIC ${CURL_INCLUDE_DIRS}) +target_link_libraries(azure-core PRIVATE CURL::libcurl Threads::Threads) +target_link_libraries(azure-core INTERFACE nlohmann_json::nlohmann_json) get_az_version("${CMAKE_CURRENT_SOURCE_DIR}/inc/azure/core/version.hpp") generate_documentation(azure-core ${AZ_LIBRARY_VERSION}) diff --git a/sdk/core/azure-core/test/ut/CMakeLists.txt b/sdk/core/azure-core/test/ut/CMakeLists.txt index b313489a8..b9218ff09 100644 --- a/sdk/core/azure-core/test/ut/CMakeLists.txt +++ b/sdk/core/azure-core/test/ut/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required (VERSION 3.13) -set(TARGET_NAME "azure-core-test") +set(azure-core-test) # Create test data for FileUpload test (100K) by writing 1K * 100 times set(RANGE 0) @@ -15,7 +15,7 @@ while(RANGE LESS 100) endwhile() add_compile_definitions(AZURE_TEST_DATA_PATH="${CMAKE_BINARY_DIR}") -project (${TARGET_NAME} LANGUAGES CXX) +project (azure-core-test LANGUAGES CXX) set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD_REQUIRED True) @@ -27,34 +27,33 @@ endif() include(GoogleTest) add_executable ( - ${TARGET_NAME} - context.cpp - ${CURL_OPTIONS_TESTS} - curl_session_test.cpp - datetime.cpp - http.cpp - json.cpp - logging.cpp - main.cpp - nullable.cpp - pipeline.cpp - policy.cpp - simplified_header.cpp - string.cpp - telemetry_policy.cpp - transport_adapter_base.cpp - ${CURL_TRANSPORT_TESTS} - url.cpp - uuid.cpp - ) + azure-core-test + context.cpp + ${CURL_OPTIONS_TESTS} + curl_session_test.cpp + datetime.cpp + http.cpp + json.cpp + logging.cpp + main.cpp + nullable.cpp + pipeline.cpp + policy.cpp + simplified_header.cpp + string.cpp + telemetry_policy.cpp + transport_adapter_base.cpp + ${CURL_TRANSPORT_TESTS} + url.cpp + uuid.cpp +) # Adding private headers from CORE to the tests so we can test the private APIs with no relative paths include. -target_include_directories (${TARGET_NAME} PRIVATE $) +target_include_directories (azure-core-test PRIVATE $) -target_link_libraries(${TARGET_NAME} PRIVATE azure-core gtest gmock) +target_link_libraries(azure-core-test PRIVATE azure-core gtest gmock) # gtest_add_tests will scan the test from azure-core-test and call add_test # for each test to ctest. This enables `ctest -r` to run specific tests directly. -gtest_add_tests(TARGET ${TARGET_NAME} +gtest_add_tests(TARGET azure-core-test TEST_PREFIX azure-core.) - diff --git a/sdk/core/performance-stress/CMakeLists.txt b/sdk/core/performance-stress/CMakeLists.txt index ac434e0c4..01ee6c1c4 100644 --- a/sdk/core/performance-stress/CMakeLists.txt +++ b/sdk/core/performance-stress/CMakeLists.txt @@ -2,23 +2,27 @@ # SPDX-License-Identifier: MIT cmake_minimum_required (VERSION 3.13) -set(TARGET_NAME "azure-perf-stress") -project(${TARGET_NAME} LANGUAGES CXX) +project(azure-perf-stress LANGUAGES CXX) set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD_REQUIRED True) add_library ( - ${TARGET_NAME} - src/placeholder.cpp - ) + azure-perf-stress + src/placeholder.cpp +) -target_include_directories (${TARGET_NAME} PUBLIC $ $) +target_include_directories( + azure-perf-stress + PUBLIC + $ + $ +) # make sure that users can consume the project as a library. -add_library (Azure::PerfStress ALIAS ${TARGET_NAME}) +add_library (Azure::PerfStress ALIAS azure-perf-stress) # Import azure-core to get a context type -target_link_libraries(${TARGET_NAME} PRIVATE azure-core) +target_link_libraries(azure-perf-stress PRIVATE azure-core) add_subdirectory(test) diff --git a/sdk/core/performance-stress/test/CMakeLists.txt b/sdk/core/performance-stress/test/CMakeLists.txt index 7f6ebd928..1b2d7b451 100644 --- a/sdk/core/performance-stress/test/CMakeLists.txt +++ b/sdk/core/performance-stress/test/CMakeLists.txt @@ -3,15 +3,13 @@ cmake_minimum_required (VERSION 3.13) -set(TARGET_NAME "azure-perf-stress-test") - -project (${TARGET_NAME} LANGUAGES CXX) +project(azure-perf-stress-test LANGUAGES CXX) set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD_REQUIRED True) add_executable ( - ${TARGET_NAME} - src/no_op_test.cpp - ) + azure-perf-stress-test + src/no_op_test.cpp +) -target_link_libraries(${TARGET_NAME} PRIVATE azure-core azure-perf-stress) +target_link_libraries(azure-perf-stress-test PRIVATE azure-core azure-perf-stress) diff --git a/sdk/template/azure-template/CMakeLists.txt b/sdk/template/azure-template/CMakeLists.txt index 32ed1e3d5..eb988d752 100644 --- a/sdk/template/azure-template/CMakeLists.txt +++ b/sdk/template/azure-template/CMakeLists.txt @@ -2,7 +2,6 @@ # SPDX-License-Identifier: MIT cmake_minimum_required (VERSION 3.13) -set(TARGET_NAME "azure-template") project(azure-template LANGUAGES CXX) set(CMAKE_CXX_STANDARD 14) @@ -13,9 +12,9 @@ include(CodeCoverage) add_library ( azure-template - src/version.cpp - src/template_client.cpp - ) + src/version.cpp + src/template_client.cpp +) target_include_directories (azure-template PUBLIC $)