Skip to content

Commit

Permalink
build: Move intx::int128 definition to main CMakeLists.txt
Browse files Browse the repository at this point in the history
  • Loading branch information
chfast committed Jun 17, 2020
1 parent 0b9809b commit 36a232e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
17 changes: 17 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,16 @@ if(INTX_FUZZING)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${fuzzing_flags}")
endif()


set(INTX_INCLUDE_DIR ${PROJECT_SOURCE_DIR}/include)

add_library(int128 INTERFACE)
add_library(intx::int128 ALIAS int128)
target_compile_features(int128 INTERFACE cxx_std_14)
target_sources(int128 INTERFACE $<BUILD_INTERFACE:${INTX_INCLUDE_DIR}/intx/int128.hpp>)
target_include_directories(int128 INTERFACE $<BUILD_INTERFACE:${INTX_INCLUDE_DIR}>$<INSTALL_INTERFACE:include>)


add_subdirectory(lib/intx)

if(INTX_TESTING)
Expand All @@ -57,6 +67,13 @@ configure_package_config_file(
INSTALL_DESTINATION ${config_dir}
)

install(
TARGETS int128
EXPORT intxTargets
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
)

install(
EXPORT intxTargets
NAMESPACE intx::
Expand Down
11 changes: 1 addition & 10 deletions lib/intx/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,6 @@
# Copyright 2019-2020 Pawel Bylica.
# Licensed under the Apache License, Version 2.0.

set(INTX_INCLUDE_DIR ${PROJECT_SOURCE_DIR}/include)

add_library(int128 INTERFACE)
add_library(intx::int128 ALIAS int128)
target_compile_features(int128 INTERFACE cxx_std_14)
target_sources(int128 INTERFACE $<BUILD_INTERFACE:${INTX_INCLUDE_DIR}/intx/int128.hpp>)
target_include_directories(int128 INTERFACE $<BUILD_INTERFACE:${INTX_INCLUDE_DIR}>$<INSTALL_INTERFACE:include>)


add_library(intx STATIC
${INTX_INCLUDE_DIR}/intx/intx.hpp
impl.cpp
Expand All @@ -21,7 +12,7 @@ target_include_directories(intx PUBLIC $<BUILD_INTERFACE:${INTX_INCLUDE_DIR}>$<I
target_link_libraries(intx PUBLIC intx::int128)

install(
TARGETS intx int128
TARGETS intx
EXPORT intxTargets
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
Expand Down

0 comments on commit 36a232e

Please sign in to comment.