Skip to content

OSAL CMake script should not force/overwrite CMAKE_C_FLAGS #312

@jphickey

Description

@jphickey

Describe the bug
The OSAL build script currently configures several compiler flags by directly setting the CMAKE_C_FLAGS variable, and also setting it differently for unit test vs. FSW code.

This was originally done for compatibility with very old CMake versions but this is no longer necessary, as any reasonable CMake version (including v2.8.12 distributed in RHEL/Centos6+) have better commands to deal with target-specific flags (e.g. target_compile_definitions, etc).

Overriding this variable is not ideal as it is expected to retain its value from the parent.

To Reproduce
Build OSAL using the current script and ENABLE_UNIT_TESTS=TRUE. CMAKE_C_FLAGS is forcibly reset twice during the CMakeLists.txt evaluation.

Expected behavior
CMAKE_C_FLAGS should not be modified by the OSAL build script. It should preserve whatever value the parent had set (if any) and use the preferred commands (e.g. target_compile_options, etc) to manage the different flags required for UT and normal FSW code.

System observed on:
Ubuntu 18.04 LTS, 64 bit

Reporter Info
Joseph Hickey, Vantage Systems, Inc.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions