Skip to content

Commit 0b02fef

Browse files
committed
cmake schenanigans (doesn't work fixme)£
Signed-off-by: TymianekPL <[email protected]>
1 parent 2c33100 commit 0b02fef

File tree

9 files changed

+208
-0
lines changed

9 files changed

+208
-0
lines changed

CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
cmake_minimum_required (VERSION 3.8)
2+
3+
add_subdirectory("cppjson");
4+
add_subdirectory("Test");

Test/CMakeLists.txt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# CMakeList.txt : CMake project for Test, include source and define
2+
# project specific logic here.
3+
#
4+
cmake_minimum_required (VERSION 3.8)
5+
6+
# Enable Hot Reload for MSVC compilers if supported.
7+
if (POLICY CMP0141)
8+
cmake_policy(SET CMP0141 NEW)
9+
set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "$<IF:$<AND:$<C_COMPILER_ID:MSVC>,$<CXX_COMPILER_ID:MSVC>>,$<$<CONFIG:Debug,RelWithDebInfo>:EditAndContinue>,$<$<CONFIG:Debug,RelWithDebInfo>:ProgramDatabase>>")
10+
endif()
11+
12+
project ("Test")
13+
14+
# Add source to this project's executable.
15+
add_executable (Test "Test.cpp" "Test.h")
16+
17+
if (CMAKE_VERSION VERSION_GREATER 3.12)
18+
set_property(TARGET Test PROPERTY CXX_STANDARD 20)
19+
endif()
20+
21+
# TODO: Add tests and install targets if needed.

Test/CMakePresets.json

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
{
2+
"version": 3,
3+
"configurePresets": [
4+
{
5+
"name": "windows-base",
6+
"hidden": true,
7+
"generator": "Ninja",
8+
"binaryDir": "${sourceDir}/out/build/${presetName}",
9+
"installDir": "${sourceDir}/out/install/${presetName}",
10+
"cacheVariables": {
11+
"CMAKE_C_COMPILER": "cl.exe",
12+
"CMAKE_CXX_COMPILER": "cl.exe"
13+
},
14+
"condition": {
15+
"type": "equals",
16+
"lhs": "${hostSystemName}",
17+
"rhs": "Windows"
18+
}
19+
},
20+
{
21+
"name": "x64-debug",
22+
"displayName": "x64 Debug",
23+
"inherits": "windows-base",
24+
"architecture": {
25+
"value": "x64",
26+
"strategy": "external"
27+
},
28+
"cacheVariables": {
29+
"CMAKE_BUILD_TYPE": "Debug"
30+
}
31+
},
32+
{
33+
"name": "x64-release",
34+
"displayName": "x64 Release",
35+
"inherits": "x64-debug",
36+
"cacheVariables": {
37+
"CMAKE_BUILD_TYPE": "Release"
38+
}
39+
},
40+
{
41+
"name": "x86-debug",
42+
"displayName": "x86 Debug",
43+
"inherits": "windows-base",
44+
"architecture": {
45+
"value": "x86",
46+
"strategy": "external"
47+
},
48+
"cacheVariables": {
49+
"CMAKE_BUILD_TYPE": "Debug"
50+
}
51+
},
52+
{
53+
"name": "x86-release",
54+
"displayName": "x86 Release",
55+
"inherits": "x86-debug",
56+
"cacheVariables": {
57+
"CMAKE_BUILD_TYPE": "Release"
58+
}
59+
}
60+
]
61+
}

Test/Test.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// Test.cpp : Defines the entry point for the application.
2+
//
3+
4+
#include "Test.h"
5+
6+
using namespace std;
7+
8+
int main()
9+
{
10+
cout << "Hello CMake." << endl;
11+
return 0;
12+
}

Test/Test.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// Test.h : Include file for standard system include files,
2+
// or project specific include files.
3+
4+
#pragma once
5+
6+
#include <iostream>
7+
8+
// TODO: Reference additional headers your program requires here.

cppjson/CMakeLists.txt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# CMakeList.txt : CMake project for cppjson, include source and define
2+
# project specific logic here.
3+
#
4+
cmake_minimum_required (VERSION 3.8)
5+
6+
# Enable Hot Reload for MSVC compilers if supported.
7+
if (POLICY CMP0141)
8+
cmake_policy(SET CMP0141 NEW)
9+
set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "$<IF:$<AND:$<C_COMPILER_ID:MSVC>,$<CXX_COMPILER_ID:MSVC>>,$<$<CONFIG:Debug,RelWithDebInfo>:EditAndContinue>,$<$<CONFIG:Debug,RelWithDebInfo>:ProgramDatabase>>")
10+
endif()
11+
12+
project ("cppjson")
13+
14+
# Add source to this project's executable.
15+
add_executable (cppjson "cppjson.cpp" "cppjson.h")
16+
17+
if (CMAKE_VERSION VERSION_GREATER 3.12)
18+
set_property(TARGET cppjson PROPERTY CXX_STANDARD 20)
19+
endif()
20+
21+
# TODO: Add tests and install targets if needed.

cppjson/CMakePresets.json

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
{
2+
"version": 3,
3+
"configurePresets": [
4+
{
5+
"name": "windows-base",
6+
"hidden": true,
7+
"generator": "Ninja",
8+
"binaryDir": "${sourceDir}/out/build/${presetName}",
9+
"installDir": "${sourceDir}/out/install/${presetName}",
10+
"cacheVariables": {
11+
"CMAKE_C_COMPILER": "cl.exe",
12+
"CMAKE_CXX_COMPILER": "cl.exe"
13+
},
14+
"condition": {
15+
"type": "equals",
16+
"lhs": "${hostSystemName}",
17+
"rhs": "Windows"
18+
}
19+
},
20+
{
21+
"name": "x64-debug",
22+
"displayName": "x64 Debug",
23+
"inherits": "windows-base",
24+
"architecture": {
25+
"value": "x64",
26+
"strategy": "external"
27+
},
28+
"cacheVariables": {
29+
"CMAKE_BUILD_TYPE": "Debug"
30+
}
31+
},
32+
{
33+
"name": "x64-release",
34+
"displayName": "x64 Release",
35+
"inherits": "x64-debug",
36+
"cacheVariables": {
37+
"CMAKE_BUILD_TYPE": "Release"
38+
}
39+
},
40+
{
41+
"name": "x86-debug",
42+
"displayName": "x86 Debug",
43+
"inherits": "windows-base",
44+
"architecture": {
45+
"value": "x86",
46+
"strategy": "external"
47+
},
48+
"cacheVariables": {
49+
"CMAKE_BUILD_TYPE": "Debug"
50+
}
51+
},
52+
{
53+
"name": "x86-release",
54+
"displayName": "x86 Release",
55+
"inherits": "x86-debug",
56+
"cacheVariables": {
57+
"CMAKE_BUILD_TYPE": "Release"
58+
}
59+
}
60+
]
61+
}

cppjson/cppjson.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// cppjson.cpp : Defines the entry point for the application.
2+
//
3+
4+
#include "cppjson.h"
5+
6+
using namespace std;
7+
8+
int main()
9+
{
10+
cout << "Hello CMake." << endl;
11+
return 0;
12+
}

cppjson/cppjson.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// cppjson.h : Include file for standard system include files,
2+
// or project specific include files.
3+
4+
#pragma once
5+
6+
#include <iostream>
7+
8+
// TODO: Reference additional headers your program requires here.

0 commit comments

Comments
 (0)