About creating sln files from folders with CMakeLists.txt in C language

Asked 2 years ago, Updated 2 years ago, 376 views

Created sln file from folder with CMakeLists.txt.
Here's a summary of the contents:

CMakeLists.txt

cmake_minimum_required (VERSION 3.0.0)
project(777VERSION 1.0.0)

include_directories (includes)

add_executable(777 
    Source/111.c
    Source/222.c
    Source/333.c

    ... (omitted) ...

    Source/777.c
    Source/888.c
    Source/999.c
)

set(CPACK_PROJECT_NAME${PROJECT_NAME})
set(CPACK_PROJECT_VERSION${PROJECT_VERSION})
include (CPack)


From the folder where CMakeLists.txt is located for use with Visual Studio 2019 I created the sln file by entering the following command:

cmake-G "Visual Studio 16 2019" - Ax64.

The sln file was completed in the same folder, and the compilation was successful in Visual Studio 2019.

If you copy the complete set of folders to a different PC and compile them again with Visual Studio 2019, the path from the previous different PC will pass, resulting in a compilation error.

Is there a way to compile a different PC relatively?

c visual-studio cmake

2022-09-30 22:00

2 Answers

Why don't we just start over from cmake on a different PC?


2022-09-30 22:00

Visual Studio is cmake-enabled, so it is recommended that you run "Open a local folder" in your environment without generating sln files.


2022-09-30 22:00

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.