Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Register
  • Sign in
  • CMake CMake
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 4,157
    • Issues 4,157
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 14
    • Merge requests 14
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • External wiki
    • External wiki
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • CMakeCMake
  • CMakeCMake
  • Issues
  • #22935
Closed
Open
Issue created Nov 19, 2021 by scivision@scivisionContributor

bug: 3.22 + Ninja Multi-Config + CMAKE_CONFIGURATION_TYPES env var

CMake 3.22 introduced environment variable CMAKE_CONFIGURATION_TYPES to set multi configuration types.

The problem appears when environment variable CMAKE_CONFIGURATION_TYPES is set to a list starting with Release, causing surprising breakage of try_compile() with Ninja Multi-Config, even for internal CMake scripts.

NOTE: using set(CMAKE_CONFIGURATION_TYPES Release;Debug) does NOT trigger the bug. It has to be environment variable CMAKE_CONFIGURATION_TYPES=Release;Debug (has to have Release as first entity of list).

I used:

  • Linux, MacOS or Windows
  • Ninja Multi-Config
  • GCC, Clang, Intel, IntelLLVM
  • environment variable CMAKE_CONFIGURATION_TYPES=Release;... (Release is first, others don't care)

NOTE: This bug is NOT FindMPI specific, I just happened to notice it with FindMPI's internal try_compile():

Reproduce problem

Set environment variable CMAKE_CONFIGURATION_TYPES=Release;Debug

Use CMakeLists.txt like:

cmake_minimum_required(VERSION 3.22)

project(oops LANGUAGES C)

find_package(MPI) 
> cmake -B build -G "Ninja Multi-Config"

results in:

-- The C compiler identification is GNU 11.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Check for working C compiler: C:/msys64/mingw64/bin/cc.exe
-- Check for working C compiler: C:/msys64/mingw64/bin/cc.exe - works
-- Detecting C compile features
-- Detecting C compile features - done
CMake Error at C:/cmake-3.22.0-windows-x86_64/share/cmake-3.22/Modules/FindMPI.cmake:1267 (try_compile):
  Cannot copy output executable

    ''

  to destination specified by COPY_FILE:

    'C:/temp/build/CMakeFiles/FindMPI/test_mpi_C.bin'

  Unable to find the executable at any of:

    C:/temp/build/CMakeFiles/CMakeTmp/cmTC_cf635.exe
    C:/temp/build/CMakeFiles/CMakeTmp/Debug/cmTC_cf635.exe
    C:/temp/build/CMakeFiles/CMakeTmp/Development/cmTC_cf635.exe

Call Stack (most recent call first):
  c:/cmake-3.22.0-windows-x86_64/share/cmake-3.22/Modules/FindMPI.cmake:1319 (_MPI_try_staged_settings)
  C:/cmake-3.22.0-windows-x86_64/share/cmake-3.22/Modules/FindMPI.cmake:1642 (_MPI_check_lang_works)
  CMakeLists.txt:5 (find_package)


CMake Error at C:/cmake-3.22.0-windows-x86_64/share/cmake-3.22/Modules/FindMPI.cmake:1746 (file):
  file STRINGS file "C:/temp/build/CMakeFiles/FindMPI/test_mpi_C.bin" cannot
  be read.
Call Stack (most recent call first):
  CMakeLists.txt:5 (find_package)


-- Found MPI_C: C:/msys64/mingw64/lib/libmsmpi.a
-- Found MPI: TRUE  found components: C
-- Configuring incomplete, errors occurred!

Notice in CMakeError.log and CMakeOutput.log that "Release" has infiltrated try_compile() commands, causing the failure.

Reference: this was causing #22824 (closed), but I didn't realize the details then

Edited Nov 22, 2021 by scivision
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking