build: Prevent the redefinition of stdlib_pch target in release builds

```
  -- Precompiled headers were enabled
  CMake Error at build-support/macros-and-definitions.cmake:1272 (add_library):
    add_library cannot create ALIAS target "stdlib_pch" because another target
    with the same name already exists.
  Call Stack (most recent call first):
    CMakeLists.txt:149 (process_options)
```

Signed-off-by: Rui Chen <rui@chenrui.dev>
This commit is contained in:
Rui Chen
2024-05-26 11:23:24 -04:00
committed by Tom Henderson
parent 99e521d4be
commit 06a0874647

View File

@@ -1297,7 +1297,11 @@ macro(process_options)
stdlib_pch${build_profile_suffix} PUBLIC
"${precompiled_header_libraries}"
)
add_library(stdlib_pch ALIAS stdlib_pch${build_profile_suffix})
# Alias may collide with actual pch in builds without suffix (e.g. release)
if(NOT TARGET stdlib_pch)
add_library(stdlib_pch ALIAS stdlib_pch${build_profile_suffix})
endif()
add_executable(
stdlib_pch_exec ${PROJECT_SOURCE_DIR}/build-support/empty-main.cc