Compare commits
3 Commits
b77437ea99
...
40bab85440
Author | SHA1 | Date | |
---|---|---|---|
40bab85440 | |||
6230552729 | |||
7ea0f8d749 |
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
*_build/
|
6
.idea/vcs.xml
generated
Normal file
6
.idea/vcs.xml
generated
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
15
README.md
Normal file
15
README.md
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
# CMake Tutorial
|
||||||
|
|
||||||
|
|
||||||
|
### Reasoning
|
||||||
|
Cmake is too popular to ignore.
|
||||||
|
Many crossplatform projects written in C and C++ use cmake as their buildtool of choice.
|
||||||
|
As this is the case I feel I need to integrate and become more comfortable with CMake myself.
|
||||||
|
|
||||||
|
[cmake.org tutorial](https://cmake.org/cmake/help/latest/guide/tutorial/A%20Basic%20Starting%20Point.html)
|
||||||
|
|
||||||
|
### What is in this repository
|
||||||
|
This directory contains source code examples for the CMake Tutorial.
|
||||||
|
Each step has its own subdirectory containing code that may be used as a
|
||||||
|
starting point. The tutorial examples are progressive so that each step
|
||||||
|
provides the complete solution for the previous step.
|
@ -1,4 +0,0 @@
|
|||||||
This directory contains source code examples for the CMake Tutorial.
|
|
||||||
Each step has its own subdirectory containing code that may be used as a
|
|
||||||
starting point. The tutorial examples are progressive so that each step
|
|
||||||
provides the complete solution for the previous step.
|
|
@ -1,16 +1,14 @@
|
|||||||
# TODO 1: Set the minimum required version of CMake to be 3.10
|
cmake_minimum_required(VERSION 3.10)
|
||||||
|
project(Tutorial)
|
||||||
# TODO 2: Create a project named Tutorial
|
|
||||||
|
|
||||||
# TODO 7: Set the project version number as 1.0 in the above project command
|
# TODO 7: Set the project version number as 1.0 in the above project command
|
||||||
|
|
||||||
# TODO 6: Set the variable CMAKE_CXX_STANDARD to 11
|
# TODO 6: Set the variable CMAKE_CXX_STANDARD to 11
|
||||||
# and the variable CMAKE_CXX_STANDARD_REQUIRED to True
|
# and the variable CMAKE_CXX_STANDARD_REQUIRED to True
|
||||||
|
set(CMAKE_CXX_STANDARD 11)
|
||||||
|
set(CMAKE_CXX_STANDARD_REQUIRED True)
|
||||||
|
|
||||||
# TODO 8: Use configure_file to configure and copy TutorialConfig.h.in to
|
# TODO 8: Use configure_file to configure and copy TutorialConfig.h.in to
|
||||||
# TutorialConfig.h
|
# TutorialConfig.h
|
||||||
|
|
||||||
# TODO 3: Add an executable called Tutorial to the project
|
add_executable(Tutorial tutorial.cxx)
|
||||||
# Hint: Be sure to specify the source file as tutorial.cxx
|
|
||||||
|
|
||||||
# TODO 9: Use target_include_directories to include ${PROJECT_BINARY_DIR}
|
# TODO 9: Use target_include_directories to include ${PROJECT_BINARY_DIR}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// A simple program that computes the square root of a number
|
// A simple program that computes the square root of a number
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <cstdlib> // TODO 5: Remove this line
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
@ -16,8 +16,7 @@ int main(int argc, char* argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
// convert input to double
|
// convert input to double
|
||||||
// TODO 4: Replace atof(argv[1]) with std::stod(argv[1])
|
const double inputValue = std::stod(argv[1]);
|
||||||
const double inputValue = atof(argv[1]);
|
|
||||||
|
|
||||||
// calculate square root
|
// calculate square root
|
||||||
const double outputValue = sqrt(inputValue);
|
const double outputValue = sqrt(inputValue);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user