← All tasks
cppgoogle/highway #2133Repaired task

cmake gives error: CMake can not determine linker language

envgap__google__highway-2133

01 / FAILURE SIGNATURE

Captured in a clean container

CMake Error: Cannot determine link language for target "hwy".

02 / ENVIRONMENT RECIPE

Base commit
1882a81de979ca4bb60941d8d3c492ee14179d6a
Manifest
CMakeLists.txt
Reproduce
cmake -S . -B build -DBUILD_TESTING=OFF && cmake --build build -j4
Run under trace
cmake --build build -j4
Reference environment fix used for admission
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7b9d732c..3f1ced81 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -174,7 +174,7 @@ set(HWY_SOURCES
     hwy/timer.h
 )
 
-if (HWY_CMAKE_HEADER_ONLY)
+if (NOT HWY_CMAKE_HEADER_ONLY)
   list(APPEND HWY_SOURCES
     hwy/abort.cc
     hwy/aligned_allocator.cc

03 / ORIGINAL ISSUE TEXT

google/highway #2133 · read the original issue
I just checked out master and tried to configure cmake, in the build folder, using my usual line of

`cmake -DBUILD_TESTING=OFF -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang ..`



 This failed, with these error messages:

```

CMake Error: Cannot determine link language for target "hwy".

CMake Error: CMake can not determine linker language for target: hwy

CMake Error in CMakeLists.txt:

  Exporting the target "hwy" is not allowed since its linker language cannot

  be determined

```

To fix this, I tried and modified the CMakeLists.txt, adding this line:

`set_property(TARGET hwy PROPERTY LINKER_LANGUAGE CXX)`

the error in the cmake invocation went away, but then I got plenty of linker errors.

I did a regression. The error only occurs from commit 99bf9204d043dbaa4f56ee17d80e5b1f8a5f3f86, when reverting to the previous commit 3adbb629e526096b698e04dc1dbe23418bf6c4b8 all works as expected, with unmodified CMakeLists.txt

Continue on GitHub ↗

04 / LABELS

Labels checked by running the task · needs human review

misspecification
Label rules and the text that matched
[
  {
    "category": "misspecification",
    "rule": "diff.changes_existing_manifest_line",
    "source": "manifest_diff:CMakeLists.txt",
    "excerpt": "-if (HWY_CMAKE_HEADER_ONLY)\n+if (NOT HWY_CMAKE_HEADER_ONLY)"
  }
]

Mined from a merged pull request linked to the issue whose changed files are all environment files.

The base commit is the pull request's base, not the dated default-branch commit; the registry is pinned to the merge date so the pull request's own pins resolve.

Default commands from envgap default-recipe synthesizer v1; gold_files are the pull request's environment diff.

Preparation uses current registries. Historical package availability is not enforced here; execution metadata records this limitation separately from the oracle's date-bounding policy.