Skip to content

Commit

Permalink
Remove duplicate include and modernize example
Browse files Browse the repository at this point in the history
  • Loading branch information
stephan-cr committed Mar 22, 2021
1 parent 873aba1 commit 0a1774d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 14 deletions.
11 changes: 4 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,16 @@ project(FormatOutput CXX)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_BINARY_DIR})
list(APPEND CMAKE_PREFIX_PATH ${CMAKE_BINARY_DIR})

add_definitions("-std=c++11")

# if(NOT EXISTS "${CMAKE_BINARY_DIR}/conan.cmake")
# message(STATUS "Downloading conan.cmake from https://github.com/conan-io/cmake-conan")
# file(DOWNLOAD "https://raw.githubusercontent.com/conan-io/cmake-conan/develop/conan.cmake"
# "${CMAKE_BINARY_DIR}/conan.cmake"
# TLS_VERIFY ON)
# endif()

# include(${CMAKE_BINARY_DIR}/conan.cmake)

include(conan.cmake)

conan_cmake_configure(REQUIRES fmt/6.1.2
conan_cmake_configure(REQUIRES fmt/6.1.2
GENERATORS cmake_find_package)

conan_cmake_autodetect(settings)
Expand All @@ -27,7 +23,8 @@ conan_cmake_install(PATH_OR_REFERENCE .
REMOTE conan-center
SETTINGS ${settings})

find_package(fmt)
find_package(fmt REQUIRED)

add_executable(main main.cpp)
target_link_libraries(main fmt::fmt)
target_link_libraries(main PRIVATE fmt::fmt)
target_compile_features(main PRIVATE cxx_std_11)
11 changes: 4 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,16 @@ project(FormatOutput CXX)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_BINARY_DIR})
list(APPEND CMAKE_PREFIX_PATH ${CMAKE_BINARY_DIR})
add_definitions("-std=c++11")
if(NOT EXISTS "${CMAKE_BINARY_DIR}/conan.cmake")
message(STATUS "Downloading conan.cmake from https://github.com/conan-io/cmake-conan")
file(DOWNLOAD "https://raw.githubusercontent.com/conan-io/cmake-conan/v0.16.1/conan.cmake"
"${CMAKE_BINARY_DIR}/conan.cmake"
TLS_VERIFY ON)
endif()
include(${CMAKE_BINARY_DIR}/conan.cmake)
include(conan.cmake)
conan_cmake_configure(REQUIRES fmt/6.1.2
conan_cmake_configure(REQUIRES fmt/6.1.2
GENERATORS cmake_find_package)
conan_cmake_autodetect(settings)
Expand All @@ -48,10 +44,11 @@ conan_cmake_install(PATH_OR_REFERENCE .
REMOTE conan-center
SETTINGS ${settings})
find_package(fmt)
find_package(fmt REQUIRED)
add_executable(main main.cpp)
target_link_libraries(main fmt::fmt)
target_link_libraries(main PRIVATE fmt::fmt)
target_compile_features(main PRIVATE cxx_std_11)
```

There are different functions you can use from your CMake project to use Conan from there. The
Expand Down

0 comments on commit 0a1774d

Please sign in to comment.