Skip to content
Snippets Groups Projects
Commit bcdc0b44 authored by Guilhem Saurel's avatar Guilhem Saurel
Browse files

[bin] Add gepetto-example-adder executable

parent 59f720a0
No related branches found
No related tags found
No related merge requests found
......@@ -41,8 +41,13 @@ if(SUFFIX_SO_VERSION)
set_target_properties(${PROJECT_NAME} PROPERTIES SOVERSION ${PROJECT_VERSION})
endif()
# Main Executable
add_executable(${PROJECT_NAMESPACE}-${PROJECT_NAME} src/main.cpp)
target_link_libraries(${PROJECT_NAMESPACE}-${PROJECT_NAME} ${PROJECT_NAME})
# Unit tests
add_subdirectory(tests)
# Installation
install(TARGETS ${PROJECT_NAME} EXPORT ${TARGETS_EXPORT_NAME} DESTINATION lib)
install(TARGETS ${PROJECT_NAMESPACE}-${PROJECT_NAME} RUNTIME DESTINATION bin)
#include <cstdlib>
#include <iostream>
#include "example-adder/gepadd.hpp"
int main(int argc, char** argv) {
if (argc == 3) {
int a = std::atoi(argv[1]), b = std::atoi(argv[2]);
std::cout << "The sum of " << a << " and " << b << " is: ";
std::cout << gepetto::example::add(a, b) << std::endl;
return EXIT_SUCCESS;
} else {
std::cerr << "This program needs 2 integers" << std::endl;
return EXIT_FAILURE;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment