Adds an extremely basic shared library
This commit is contained in:
parent
9e92799698
commit
d71f284625
|
|
@ -10,11 +10,33 @@ find_package(CLI11 REQUIRED)
|
|||
set(BUILD_DIR "${PROJECT_SOURCE_DIR}/build")
|
||||
set(CLI11_DIR ${BUILD_DIR})
|
||||
|
||||
file(GLOB SOURCES "src/*.cpp")
|
||||
# include_directories(include)
|
||||
|
||||
add_executable(${PROJECT_NAME} ${SOURCES})
|
||||
target_link_libraries(${PROJECT_NAME} CLI11::CLI11)
|
||||
install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION bin)
|
||||
add_library(challenge SHARED
|
||||
src/File.cpp
|
||||
)
|
||||
target_include_directories(challenge PUBLIC include)
|
||||
|
||||
add_executable(${PROJECT_NAME}
|
||||
src/cppchallenge.cpp
|
||||
)
|
||||
|
||||
target_link_libraries(${PROJECT_NAME}
|
||||
CLI11::CLI11
|
||||
challenge
|
||||
)
|
||||
|
||||
set_target_properties(${PROJECT_NAME}
|
||||
PROPERTIES
|
||||
PUBLIC_HEADER
|
||||
include/File.h
|
||||
)
|
||||
|
||||
install(TARGETS ${PROJECT_NAME} challenge
|
||||
RUNTIME DESTINATION bin
|
||||
LIBRARY DESTINATION lib
|
||||
PUBLIC_HEADER DESTINATION include
|
||||
)
|
||||
|
||||
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
||||
include(packdeb)
|
||||
|
|
|
|||
|
|
@ -1,11 +0,0 @@
|
|||
#include "CLI/CLI.hpp"
|
||||
#include <iostream>
|
||||
|
||||
int main(int argc, char *argv[]){
|
||||
CLI::App app{"Just a simple 'hello'"};
|
||||
CLI11_PARSE(app, argc, argv);
|
||||
std::cout << "Hello World!" << std::endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// vim: set ts=4 expandtab :
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
#include<string>
|
||||
|
||||
class File {
|
||||
|
||||
private:
|
||||
const std::string name;
|
||||
|
||||
public:
|
||||
File(const std::string);
|
||||
const std::string getName() const;
|
||||
};
|
||||
|
||||
// vim: set ts=4 expandtab :
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
#include "File.h"
|
||||
|
||||
File::File(const std::string name):
|
||||
name(name)
|
||||
{
|
||||
}
|
||||
|
||||
const std::string File::getName() const {
|
||||
return name;
|
||||
}
|
||||
|
||||
// vim: set ts=4 expandtab :
|
||||
|
|
@ -1,10 +1,15 @@
|
|||
#include "CLI/CLI.hpp"
|
||||
#include "File.h"
|
||||
#include <iostream>
|
||||
|
||||
int main(int argc, char *argv[]){
|
||||
CLI::App app{"Just a simple 'hello'"};
|
||||
CLI11_PARSE(app, argc, argv);
|
||||
|
||||
File afile("aname");
|
||||
|
||||
std::cout << "Hello World!" << std::endl;
|
||||
std::cout << "File name is: " << afile.getName() << std::endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue