Having trouble finding and linking with cmake on windows.

Post Reply
scd
Posts: 1
Joined: Sat Jan 20 2024 6:20 am

Having trouble finding and linking with cmake on windows.

Post by scd »

as the title says. im having trouble getting cmake to find and link to copperspice. im not sure if there's something wrong with copperspice on windows or if my approach is wrong.

cmake configuration error:

Code: Select all

C:\Users\Raiden\Documents\programming\CopperTest\build>cmake ..
-- Selecting Windows SDK version 10.0.22621.0 to target Windows 10.0.19045.
CMake Error at CMakeLists.txt:8 (find_package):
  By not providing "FindCopperSpice.cmake" in CMAKE_MODULE_PATH this project
  has asked CMake to find a package configuration file provided by
  "CopperSpice", but CMake did not find one.

  Could not find a package configuration file provided by "CopperSpice" with
  any of the following names:

    CopperSpiceConfig.cmake
    copperspice-config.cmake

  Add the installation prefix of "CopperSpice" to CMAKE_PREFIX_PATH or set
  "CopperSpice_DIR" to a directory containing one of the above files.  If
  "CopperSpice" provides a separate development package or SDK, be sure it
  has been installed.


-- Configuring incomplete, errors occurred!
my cmakelists is as follows.

Code: Select all

cmake_minimum_required(VERSION 3.20)

project(CopperTest)

add_executable(CTest main.cpp)

list(APPEND ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_LIST_DIR}/copperspice-cs-1.8.2/cmake/modules)
find_package(CopperSpice REQUIRED)
project directory structure:
CopperTest/
----------------build/
----------------main.cpp
----------------CMakeLists.txt
----------------copperspice-cs-1.8.2/
----------------copperspice-cs-1.8.2.zip

i build copperspice from source in the copperspice-cs-1.8.2 directory so the layout in there should be familiar.
barbara
Posts: 442
Joined: Sat Apr 04 2015 2:32 am
Contact:

Re: Having trouble finding and linking with cmake on windows.

Post by barbara »

On Windows we have fully tested CopperSpice when building with MinGW or MSVC.

** Part One ( building CS )

When building from source you need to ensure CopperSpice is "installed" after it is built. The following is our suggested setup of folder names. The purpose of the install step to populate the required files in the cs_lib folder.

CS Source Pathcs_source
CS Build Pathcs_build
CS Install Pathcs_lib

https://www.copperspice.com/docs/cs_overview/build-overview.html#build-howto

https://www.copperspice.com/docs/cs_overview/build-msvc.html (msvc)
https://www.copperspice.com/docs/cs_overview/build-win.html (mingw)


** Part Two ( building your application )

To build and install the application you will need to pass a few parameters when running CMake. Here is an example:

Code: Select all

cmake -G "Ninja" -DCMAKE_PREFIX_PATH=[path_to_cs_lib]  -DCMAKE_INSTALL_PREFIX=[deploy_path]   [source_path]
ninja install
For more information please refer to our CopperSpice Journal. Example 1 is very short and shows the entire process for all supported platforms.

https://journal.copperspice.com/?p=160   Build File (Gui Example 1)
https://journal.copperspice.com/?p=180   Compile, Link, and Run (Gui Example 1)

Please let us know if you have other questions.

Barbara
Post Reply