0

Cannot create proper CMakeLists.txt file - Cmake tells that

CMake Error: Cannot determine link language for target "GLFW". CMake Error: CMake can not determine linker language for target: GLFW Generating done (0.0s) CMake Generate step failed. Build files cannot be regenerated correctly.

#include <iostream>
#include "include/GLFW/glfw3.h"
#include "include/GLFW/glfw3native.h"

int main()
{
return 0;
}
~ 
cmake_minimum_required(VERSION 3.15...3.25)

project(MyProject
  VERSION
    1.0
  DESCRIPTION
    "Very nice project"
  LANGUAGES
    CXX
)

add_library(GLFW
include/GLFW/glfw3.h
include/GLFW/glfw3native.h
lib/libglfw3.a
)

add_executable(myexample letter.cpp)

target_link_libraries(myexample PRIVATE GLFW)

tree looks like:

a1312@MacBook-Air-1312 source % tree
.
├── CMakeLists.txt
├── include
│   └── GLFW
│       ├── glfw3.h
│       └── glfw3native.h
├── letter
├── letter.cpp
├── letters.cpp
└── lib
    ├── libglfw.3.dylib
    └── libglfw3.a

4 directories, 8 files

What am I doing wrong?

Already tried steps from glfw-site, but it not helped

ti7
  • 16,375
  • 6
  • 40
  • 68
KireC
  • 9
  • 1
  • It seems that you want to link with the already existed `.a` library file. Specifying that library file in `add_library` call is wrong. You may want to create IMPORTED library and specify that file in its IMPORTED_LOCATION property, like in [that answer](https://stackoverflow.com/a/10550334/3440745) to the duplicate question. – Tsyvarev Jul 30 '23 at 16:56

0 Answers0