mirror of
https://github.com/vimpunk/mio.git
synced 2025-12-08 01:36:52 +08:00
Add Header-Only cmake project structure
This commit is contained in:
parent
f3b8286c47
commit
90fbf407f3
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,3 +1,4 @@
|
||||
test/**
|
||||
!test/test.cpp
|
||||
!test/example.cpp
|
||||
build/
|
||||
|
||||
42
CMakeLists.txt
Normal file
42
CMakeLists.txt
Normal file
@ -0,0 +1,42 @@
|
||||
cmake_minimum_required( VERSION 3.2.2 )
|
||||
project( mio )
|
||||
|
||||
### Standard
|
||||
set( CMAKE_CXX_STANDARD 11 )
|
||||
set( CMAKE_CXX_STANDARD_REQUIRED ON )
|
||||
set( CMAKE_CXX_EXTENSIONS ON )
|
||||
|
||||
### Verbosity
|
||||
set( CMAKE_COLOR_MAKEFILE ON )
|
||||
set( CMAKE_VERBOSE_MAKEFILE ON )
|
||||
|
||||
# Generate 'compile_commands.json' for clang_complete
|
||||
set( CMAKE_EXPORT_COMPILE_COMMANDS ON )
|
||||
|
||||
### Flags
|
||||
if( MSVC )
|
||||
add_compile_options( /W3 )
|
||||
elseif( CMAKE_COMPILER_IS_GNUCXX )
|
||||
add_compile_options( -Wall )
|
||||
add_compile_options( -Wextra )
|
||||
endif()
|
||||
|
||||
### Library targets
|
||||
add_library( mio INTERFACE)
|
||||
target_include_directories( mio INTERFACE include )
|
||||
|
||||
### Test targets
|
||||
|
||||
## test
|
||||
add_executable(
|
||||
test
|
||||
test/test.cpp
|
||||
)
|
||||
target_link_libraries( test PRIVATE mio )
|
||||
|
||||
## example
|
||||
add_executable(
|
||||
example
|
||||
test/example.cpp
|
||||
)
|
||||
target_link_libraries( example PRIVATE mio )
|
||||
@ -1,4 +1,4 @@
|
||||
#include "../include/mio/mmap.hpp"
|
||||
#include <mio/mmap.hpp>
|
||||
#include <system_error> // for std::error_code
|
||||
#include <cstdio> // for std::printf
|
||||
#include <cassert>
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
#include "../include/mio/mmap.hpp"
|
||||
#include "../include/mio/shared_mmap.hpp"
|
||||
#include <mio/mmap.hpp>
|
||||
#include <mio/shared_mmap.hpp>
|
||||
|
||||
#include <string>
|
||||
#include <fstream>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user