Avoid compilation issues in consumer projects
Description
As originally discussed in the FreeRTOS Forums, projects that consume FreeRTOS-Plus-TCP are forced to use the compilation options configured by test/build-combination/CMakeLists.txt when compiling freertos_plus_tcp which can cause compilation issues. This PR avoids compilation issues in consumer projects by making processing of test/build-combination/CMakeLists.txt optional:
- Added
FREERTOS_PLUS_TCP_BUILD_BUILD_TESToption to control whethertest/build-combination/CMakeLists.txtis processed. Updated.github/workflows/ci.ymlbuild-checksjob andtest/build-combination/README.mdto reflect the addition of this new option. - Moved
FREERTOS_PLUS_TCP_TEST_CONFIGURATIONcache variable configuration/validation totest/build-combination/CMakeLists.txtsince it is now only needed ifFREERTOS_PLUS_TCP_BUILD_BUILD_TESTisON. Updated comments to reflect changes. - Moved configuration of the C standard used to compile
freertos_plus_tcptotest/build-combination/CMakeLists.txtso that projects that consume FreeRTOS-Plus-TCP can control the C standard they use when compilingfreertos_plus_tcp.
The following changes were considered but are not currently implemented in this PR:
- Rename the
FREERTOS_PLUS_TCP_BUILD_TESToption toFREERTOS_PLUS_TCP_BUILD_UNIT_TESTto better indicate what it controls. - Rename the
test/build-combination/directory totest/build-test/to better reflect what its contents are for and mirror thetest/unit-test/directory's naming. - Rename the
FREERTOS_PLUS_TCP_TEST_CONFIGURATIONcache variable toFREERTOS_PLUS_TCP_BUILD_TEST_CONFIGURATIONto reflect its association with the newFREERTOS_PLUS_TCP_BUILD_BUILD_TESToption.
Test Steps
Compilation issues were encountered in a private project (see https://forums.freertos.org/t/freertos-plus-tcp-compilation-issues/19825/4) that is built using arm-none-eabi-gcc (9.2.1) for an Arm Cortex-M4F processor. The changes made in this PR have resolved the compilation issues that were encountered in that private project. These changes have also been tested using the instructions in https://github.com/FreeRTOS/FreeRTOS-Plus-TCP/blob/86b16eb1f514574df19a31c78c8937600ba5a81a/test/build-combination/README.md#unix-linux-and-mac and https://github.com/FreeRTOS/FreeRTOS-Plus-TCP/blob/86b16eb1f514574df19a31c78c8937600ba5a81a/test/unit-test/README.md#to-run-the-unit-tests.
Checklist:
- [x] I have tested my changes. No regression in existing tests.
- [ ] I have modified and/or added unit-tests to cover the code changes in this Pull Request.
Related Issue
None.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.