CMAKE query

Hello, I'm trying to build a simply text project using CMake for the first time, but I get undefined reference errors for my calls to pdcurses methods (external library). Could someone advise what I am missing? I have all my source/header files in 1 directory along with the CmakeLists file, and 2 folders (include, containing curses.h, and lib, containing pdcurses.lib)

here is my cmake file (keeping it short by removing all files except main.cpp)

I believe it fails at the linking stage since I get object files for all my .cpps

1
2
3
4
5
6
7
8
9
10
11
cmake_minimum_required(VERSION 3.23)
project(testproject)

set(CMAKE_CXX_STANDARD 20)

include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include/)

add_executable(my_exe
        main.cpp)

target_link_libraries(my_exe ${CMAKE_CURRENT_SOURCE_DIR}/lib/pdcurses.lib)
Last edited on
thank you, I'd since looked at that, it turned out that the linking step was failing because the pdcurses library file was 32-bit, and I was compiling for 64-bit. Once I build a 64-bit version of pdcurses it linked OK. The errors never told me this though, just that it was skipping incompatible library :)
Topic archived. No new replies allowed.