OVERVIEW
CMake can generate a native build environment that will compile source code, create libraries, generate wrappers and build executable binaries in arbitrary combinations. CMake supports in-place and out-of-place builds, and can therefore support multiple builds from a single source tree.
CMake has support for static and dynamic library builds. Another nice feature of CMake is that it can generate a cache file that is designed to be used with a graphical editor. For example, while CMake is running, it locates include files, libraries, and executables, and may encounter optional build directives. This information is gathered into the cache, which may be changed by the user prior to the generation of the native build files.
GET STARTED
To verify the installation, follow the below instructions
Step 1. Connect to SSH:
Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/.
In the navigation pane, choose Instances.
Select the instance and choose Connect.
Choose SSH Client
Copy the SSH command and paste it into the terminal.
ssh rocky@publicIP -i [Path of key pair file]
If it shows an access denied message run the following command, then rerun the above command to connect via ssh.
chmod 400 [Path of key pair file]
Once launched in the Amazon EC2 Service, please connect to the instance via an SSH client using the ec2-user with the key pair associated at launch. Once connected as the ec2-user user, you will be able to sudo to the root user
Step 2. Verify the installation
Follow the steps to verify the CMake installation
1. Login with ssh
2. Type the below command to check the version
cmake --version
You will see the responses as shown below.
How to use CMake compiler in the terminal:
1. After connecting with ssh enter the following command in order to open an empty file by the name given below:
sudo vi main.cpp
2. Run the following command in order to run the script:
#include <iostream>
int main(int argc, char** argv){
std::cout << "Hello World" << std::endl;
return 0;
}
3. The CMakeLists.txt file is to be used to compile the main.cpp file is :
sudo vi CMakeLists.txt
4. Paste the below code in the CMakeLists.txt
project(HelloWorld)
cmake_minimum_required(VERSION 3.23)
add_executable(hello_world main.cpp)
5. Create a build directory :
mkdir build
ls
cd build/
6. After that run the below command :
cmake ..
7. After that run the below command :
make
8. Run the below command to run the code:
./hello_world
9. If you get the "Hello World in output then your CMake is working properly.
To monitor and assess application functions:-
a. Navigate to your Amazon EC2 console and verify that you're in the correct region.
b. Choose Instances and select your launched instance.
c. Select the server to display your metadata page and choose the Status checks tab at the bottom of the page to review if your status checks passed or failed.
For information about how to use the application, please visit: https://lappweb.in2p3.fr/~paubert/ASTERICS_HPC/2-2-100.html
For detailed information about managing and requesting increased service please visit: https://docs.aws.amazon.com/general/latest/gr/aws_service_limits.html
Comments