CMake cant find my static library in my defined path

I’m trying to build a binary from a static lib and a header file. It works perfectly on Windows but on Linux(Ubuntu 22.04) it does not want to work.
This is my CMake file(I have not added the windows part to make it clearer)

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>make_minimum_required(VERSION 3.19)
# Set the project name and C++ standard
project(Main)
set(CMAKE_CXX_STANDARD 17)
# Add the header file directory
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../src")
# Find the static library
set(SIMPROTOCOL_LIB_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../out/build/linux-release")
find_library(SIMPROTOCOL_LIB NAMES SimLib PATHS ${SIMPROTOCOL_LIB_DIR} NO_DEFAULT_PATH)
set(SOURCE_FILES main.cpp)
# Define the executable that is built from the source file
add_executable(Main${SOURCE_FILES})
target_link_libraries(Main PRIVATE ${SIMPROTOCOL_LIB})
</code>
<code>make_minimum_required(VERSION 3.19) # Set the project name and C++ standard project(Main) set(CMAKE_CXX_STANDARD 17) # Add the header file directory include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../src") # Find the static library set(SIMPROTOCOL_LIB_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../out/build/linux-release") find_library(SIMPROTOCOL_LIB NAMES SimLib PATHS ${SIMPROTOCOL_LIB_DIR} NO_DEFAULT_PATH) set(SOURCE_FILES main.cpp) # Define the executable that is built from the source file add_executable(Main${SOURCE_FILES}) target_link_libraries(Main PRIVATE ${SIMPROTOCOL_LIB}) </code>
make_minimum_required(VERSION 3.19)

# Set the project name and C++ standard
project(Main)
set(CMAKE_CXX_STANDARD 17)

# Add the header file directory
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../src")

# Find the static library
set(SIMPROTOCOL_LIB_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../out/build/linux-release")
find_library(SIMPROTOCOL_LIB NAMES SimLib PATHS ${SIMPROTOCOL_LIB_DIR} NO_DEFAULT_PATH)


set(SOURCE_FILES main.cpp)

# Define the executable that is built from the source file
add_executable(Main${SOURCE_FILES})

target_link_libraries(Main PRIVATE ${SIMPROTOCOL_LIB})

It basically says

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>[cmake] CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
[cmake] Please set them or make sure they are set and tested correctly in the CMake files:
[cmake] SIMPROTOCOL_LIB
</code>
<code>[cmake] CMake Error: The following variables are used in this project, but they are set to NOTFOUND. [cmake] Please set them or make sure they are set and tested correctly in the CMake files: [cmake] SIMPROTOCOL_LIB </code>
[cmake] CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
[cmake] Please set them or make sure they are set and tested correctly in the CMake files:
[cmake] SIMPROTOCOL_LIB

Other notes:

  • It builds when I invoke the g++ with the arguments and everything pointing to the header files and the static lib
  • My path name has spaces but I changed the path of the static lib to a different one with no spaces and it does not work with CMake
  • Yes, I’ve reviewed the path to the static lib, the path is correct

If this doesn’t work, I’ll just create a Makefile but I rather make it work with CMake.

Thanks in advance!

1

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật