Do not use ${TARGET_NAME} unless necessary (#1094)
This commit is contained in:
parent
d1f162f9e3
commit
bbe4b54528
@ -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()
|
||||
endfunction()
|
||||
|
||||
@ -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 $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/inc> $<INSTALL_INTERFACE:include/az_core>)
|
||||
target_include_directories(
|
||||
azure-core
|
||||
PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/inc>
|
||||
$<INSTALL_INTERFACE:include/az_core>
|
||||
)
|
||||
|
||||
# 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})
|
||||
|
||||
@ -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 $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../../src>)
|
||||
target_include_directories (azure-core-test PRIVATE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../../src>)
|
||||
|
||||
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.)
|
||||
|
||||
|
||||
@ -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 $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/inc> $<INSTALL_INTERFACE:include/az_core>)
|
||||
target_include_directories(
|
||||
azure-perf-stress
|
||||
PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/inc>
|
||||
$<INSTALL_INTERFACE:include/az_core>
|
||||
)
|
||||
|
||||
# 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)
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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 $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/inc>)
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user