Skip to content

Commit 3189df7

Browse files
committed
updated to conanfile.py
1 parent 63e3e5f commit 3189df7

5 files changed

Lines changed: 23 additions & 36 deletions

File tree

cmake/Conan.cmake

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
SET(CONAN_FILE "conanfile_default.txt.in")
2-
IF(CMAKE_CROSSCOMPILING)
3-
SET(CONAN_FILE "conanfile_embedded.txt.in")
4-
ENDIF()
5-
CONFIGURE_FILE("${CMAKE_SOURCE_DIR}/conan/${CONAN_FILE}" "${CMAKE_SOURCE_DIR}/conanfile.txt" ESCAPE_QUOTES)
6-
71
# Download automatically, you can also just copy the conan.cmake file
82
IF(NOT EXISTS "${CMAKE_BINARY_DIR}/conan.cmake")
93
MESSAGE(STATUS "Downloading conan.cmake from https://github.com/conan-io/cmake-conan")

conan/conanfile_default.txt.in

Lines changed: 0 additions & 17 deletions
This file was deleted.

conan/conanfile_embedded.txt.in

Lines changed: 0 additions & 11 deletions
This file was deleted.

conanfile.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import conans.model.requires
2+
from conan import ConanFile
3+
from conan.tools.cmake import CMakeToolchain
4+
5+
6+
class HelloConan(ConanFile):
7+
settings = 'os', 'compiler', 'build_type', 'arch'
8+
generators = 'CMakeDeps', 'CMakeToolchain'
9+
10+
def configure(self):
11+
if self.settings.get_safe('arch') == 'armv7':
12+
self.requires = conans.model.requires.Requirements(['fmt/10.1.0'])
13+
self.default_options = {'fmt/*:header_only': True}
14+
else:
15+
self.requires = conans.model.requires.Requirements(['catch2/3.3.2', 'gtest/1.13.0', 'docopt.cpp/0.6.3',
16+
'fmt/10.1.0', 'sml/1.1.6'])
17+
18+
def build(self):
19+
cmake = CMakeToolchain(self)
20+
cmake.configure()
21+
cmake.build()

test/gtest/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ INCLUDE(CTest)
44
INCLUDE(GoogleTest)
55

66
ADD_EXECUTABLE(gtest_tests tests.cpp)
7-
TARGET_LINK_LIBRARIES(gtest_tests PRIVATE project_warnings project_options GTest::gtest_main GTest::gtest)
7+
TARGET_LINK_LIBRARIES(gtest_tests PRIVATE project_warnings project_options GTest::gtest_main)
88

99
# automatically discover tests that are defined in gtest based test files you can modify the unittests. Set TEST_PREFIX
1010
# to whatever you want, or use different for different binaries
@@ -17,7 +17,7 @@ GTEST_DISCOVER_TESTS(
1717

1818
# Add a file containing a set of constexpr tests
1919
ADD_EXECUTABLE(gtest_constexpr_tests constexpr_tests.cpp)
20-
TARGET_LINK_LIBRARIES(gtest_constexpr_tests PRIVATE project_options project_warnings GTest::gtest_main GTest::gtest)
20+
TARGET_LINK_LIBRARIES(gtest_constexpr_tests PRIVATE project_options project_warnings GTest::gtest_main)
2121

2222
GTEST_DISCOVER_TESTS(
2323
gtest_constexpr_tests

0 commit comments

Comments
 (0)