tweaks to compile
This commit is contained in:
parent
8241aa3e04
commit
d14a639143
5 changed files with 23 additions and 22 deletions
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
cmake_minimum_required(VERSION 4.1.2)
|
cmake_minimum_required(VERSION 4.1.2)
|
||||||
|
|
||||||
project(project_name_here
|
project(psl
|
||||||
VERSION 0.1
|
VERSION 0.1
|
||||||
LANGUAGES CXX)
|
LANGUAGES CXX)
|
||||||
|
|
||||||
|
|
@ -25,7 +25,3 @@ set(CMAKE_CXX_FLAGS "-Wall -pedantic -Wextra -Wfloat-equal -Wundef -Wpointer-ari
|
||||||
|
|
||||||
# lib src code
|
# lib src code
|
||||||
add_subdirectory(src)
|
add_subdirectory(src)
|
||||||
|
|
||||||
# app source code
|
|
||||||
add_subdirectory(apps)
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,8 +0,0 @@
|
||||||
# based heavily on https://gitlab.com/CLIUtils/modern-cmake/-/blob/master/examples/extended-project/apps/CMakeLists.txt
|
|
||||||
|
|
||||||
add_executable(exe_name exe_entry.cpp)
|
|
||||||
|
|
||||||
# example library link
|
|
||||||
#target_link_libraries(exe_name fmt::fmt)
|
|
||||||
|
|
||||||
target_compile_features(exe_name PRIVATE cxx_std_20)
|
|
||||||
|
|
@ -1,4 +0,0 @@
|
||||||
int main(void){
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
18
include/visiting.h
Normal file
18
include/visiting.h
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
|
||||||
|
namespace psl {
|
||||||
|
|
||||||
|
/// usage:
|
||||||
|
/// const auto visitor = overloads {
|
||||||
|
/// [](type_1 v){...},
|
||||||
|
/// [](type_2 v){...},
|
||||||
|
/// ...
|
||||||
|
/// };
|
||||||
|
/// visitor will then be an object with an overloaded function call op
|
||||||
|
/// which accepts type_1, type_2, etc
|
||||||
|
/// got this code from https://en.cppreference.com/w/cpp/utility/variant/visit
|
||||||
|
/// seems to need C++20 to work but haven't researched to double check
|
||||||
|
template <class... Ts> struct overloads : Ts... {
|
||||||
|
using Ts::operator()...;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace psl
|
||||||
|
|
@ -1,17 +1,16 @@
|
||||||
# based heavily on https://gitlab.com/CLIUtils/modern-cmake/-/blob/master/examples/extended-project/src/CMakeLists.txt
|
# based heavily on https://gitlab.com/CLIUtils/modern-cmake/-/blob/master/examples/extended-project/src/CMakeLists.txt
|
||||||
|
|
||||||
# example from when I was doing raft cpp impl
|
set(HEADER_LIST "${psl_SOURCE_DIR}/include/visiting.h")
|
||||||
#set(HEADER_LIST "${raft_cpp_impl_SOURCE_DIR}/include/raft/lib.hpp")
|
|
||||||
|
|
||||||
add_library(example_lib lib.cpp ${HEADER_LIST})
|
add_library(psl lib.cpp ${HEADER_LIST})
|
||||||
|
|
||||||
# We need this directory, and users of our library will need it too
|
# We need this directory, and users of our library will need it too
|
||||||
target_include_directories(example_lib PUBLIC ../include)
|
target_include_directories(psl PUBLIC ../include)
|
||||||
|
|
||||||
|
|
||||||
#target_link_libraries(example_lib PRIVATE Boost::boost)
|
#target_link_libraries(example_lib PRIVATE Boost::boost)
|
||||||
|
|
||||||
target_compile_features(example_lib PUBLIC cxx_std_17)
|
target_compile_features(psl PUBLIC cxx_std_20)
|
||||||
|
|
||||||
# IDEs should put the headers in a nice place
|
# IDEs should put the headers in a nice place
|
||||||
source_group(
|
source_group(
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue