Skip to content

Commit 7b883f0

Browse files
committed
migrate from conan to CPM, depends on CMake only
1 parent a02c145 commit 7b883f0

File tree

6 files changed

+1429
-43
lines changed

6 files changed

+1429
-43
lines changed

.gitignore

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,38 @@
33
**/*.so
44
**/*.dylib
55

6+
# Legacy Conan files (no longer used with CPM)
67
conan.lock
78
conan_paths.cmake
89
conanbuildinfo.txt
910
conaninfo.txt
1011
graph_info.json
1112

13+
# CMake build artifacts
1214
CMakeCache.txt
1315
CMakeFiles
1416
Testing
15-
build/*.cmake
16-
Makefile
17+
build/
18+
build-*/
1719
cmake-build-*
20+
Makefile
21+
*.cmake
22+
!cmake/CPM.cmake
23+
!cmake_module/conan.cmake
24+
25+
# CPM cache (optional - can be shared across projects)
26+
_deps/
1827

19-
.idea
28+
# IDE and editor files
29+
.idea/
30+
.vscode/
31+
.vs/
32+
.devcontainer/
2033
compile_commands.json
2134
DartConfiguration.tcl
2235
**/*.cbp
23-
2436
tags
37+
38+
# macOS
39+
.DS_Store
40+
._*

CMakeLists.txt

Lines changed: 38 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,46 @@
11
cmake_minimum_required(VERSION 3.19)
22
project(developer_joyofenergy_cpp)
33

4-
list(APPEND CMAKE_MODULE_PATH
5-
${CMAKE_BINARY_DIR}
6-
${CMAKE_SOURCE_DIR}/cmake_module)
7-
list(APPEND CMAKE_PREFIX_PATH ${CMAKE_BINARY_DIR})
8-
94
set(CMAKE_CXX_STANDARD 17)
105

11-
include(conan)
12-
13-
conan_cmake_configure(REQUIRES boost/1.76.0
14-
REQUIRES gtest/1.11.0
15-
REQUIRES nlohmann_json/3.9.1
16-
REQUIRES date/3.0.1
17-
OPTIONS boost:header_only=True
18-
OPTIONS date:header_only=True
19-
GENERATORS cmake_find_package)
20-
21-
conan_cmake_autodetect(settings)
22-
23-
conan_cmake_install(PATH_OR_REFERENCE .
24-
BUILD missing
25-
REMOTE conancenter
26-
SETTINGS ${settings})
6+
# Include CPM package manager
7+
include(cmake/CPM.cmake)
8+
9+
# Boost (header-only libraries: Beast, Asio, System)
10+
CPMAddPackage(
11+
NAME Boost
12+
VERSION 1.84.0
13+
URL https://github.com/boostorg/boost/releases/download/boost-1.84.0/boost-1.84.0.tar.xz
14+
URL_HASH SHA256=2e64e5d79a738d0fa6fb546c6e5c2bd28f88d268a2a080546f74e5ff98f29d0e
15+
OPTIONS
16+
"BOOST_ENABLE_CMAKE ON"
17+
"BOOST_INCLUDE_LIBRARIES beast\;asio\;system"
18+
)
19+
20+
CPMAddPackage(
21+
NAME googletest
22+
GITHUB_REPOSITORY google/googletest
23+
GIT_TAG v1.15.2
24+
VERSION 1.15.2
25+
OPTIONS
26+
"INSTALL_GTEST OFF"
27+
"gtest_force_shared_crt ON"
28+
)
29+
30+
CPMAddPackage(
31+
NAME nlohmann_json
32+
GITHUB_REPOSITORY nlohmann/json
33+
VERSION 3.11.3
34+
)
35+
36+
CPMAddPackage(
37+
NAME date
38+
GITHUB_REPOSITORY HowardHinnant/date
39+
GIT_TAG v3.0.4
40+
OPTIONS
41+
"USE_SYSTEM_TZ_DB ON"
42+
"BUILD_TZ_LIB OFF"
43+
)
2744

2845
add_subdirectory(rest)
2946
add_executable(app main.cpp)

README.md

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -57,19 +57,13 @@ These values are used in the code and in the following examples too.
5757

5858
## Requirements
5959

60-
The project requires Cmake 3.21 or
61-
higher.
60+
The project requires CMake 3.19 or higher.
6261

63-
The project makes use of Conan.(Conan's installation documentation can be found here : [https://docs.conan.io/en/latest/installation.html](https://docs.conan.io/en/latest/installation.html)). **Tips: you need Python >= 3.5 distribution installed on your machine**
62+
The project uses CPM (CMake Package Manager) to automatically download and manage dependencies. No additional package manager installation is required.
6463

65-
## Useful Conan commands
64+
## Build the project
6665

67-
The project makes use of [Conan](https://conan.io/) to help you out carrying some common tasks such as building
68-
the project or running it.
69-
70-
### Build the project
71-
72-
Compiles the project, runs the test and then creates an executable file.
66+
Compiles the project, runs the tests and then creates an executable file.
7367

7468
```console
7569
$ mkdir build && cd build

0 commit comments

Comments
 (0)