diff --git a/CMakeLists.txt b/CMakeLists.txt index b72f81a9401c69a8e50d5f2d4272dbab37d0b0d0..72e16900dae4095cb73284b886b9a8fe41ec2ef1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) diff --git a/src/main.cpp b/src/main.cpp new file mode 100644 index 0000000000000000000000000000000000000000..2c18b59c568ba131b61e1aba0aeca986dfc6a9e6 --- /dev/null +++ b/src/main.cpp @@ -0,0 +1,16 @@ +#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; + } +}