Skip to content

Commit

Permalink
fix cmake
Browse files Browse the repository at this point in the history
  • Loading branch information
EndrII committed Jun 2, 2020
1 parent e97e586 commit 4f8a941
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 19 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
# Prerequisites
*.d

*Testing/*

# Object files
*.o
*.ko
Expand Down
2 changes: 1 addition & 1 deletion CMake
19 changes: 12 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,24 @@
# of this license document, but changing it is not allowed.
#

cmake_minimum_required(VERSION 3.1)
project(MainQtBigint)
cmake_minimum_required(VERSION 3.10)
project(QtBigint LANGUAGES CXX)
if(TARGET ${PROJECT_NAME})
message("The ${PROJECT_NAME} arledy included in main Project")
return()
endif()

include(CMake/ccache.cmake)
include(CMake/QuasarAppCITargets.cmake)

initAll()

# Add sub directories
add_subdirectory(src)

if(DEFINED WITHOUT_TESTS)
message("conigured without tests")
else()
find_library(QT Qt5Core)

if(EXISTS ${QT})
add_subdirectory(tests)
endif()
endif(EXISTS ${QT})

initAll()
10 changes: 6 additions & 4 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
# of this license document, but changing it is not allowed.
#

cmake_minimum_required(VERSION 3.1)
include(../CMake/crossplatform/crossplatform.cmake)
cmake_minimum_required(VERSION 3.10)
set(CURRENT_PROJECT ${PROJECT_NAME})

project(QtBigint LANGUAGES CXX)

Expand All @@ -15,9 +15,11 @@ include(../CMake/Version.cmake)

file(GLOB SOURCE_CPP
"*.cpp"
"mini-gmp.c"
)
set_source_files_properties(mini-gmp.c PROPERTIES LANGUAGE CXX )

add_library(${PROJECT_NAME} SHARED ${SOURCE_CPP})
target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
add_library(${CURRENT_PROJECT} SHARED ${SOURCE_CPP})
target_include_directories(${CURRENT_PROJECT} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})

setVersion(6 1 2)
15 changes: 8 additions & 7 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
# of this license document, but changing it is not allowed.
#

cmake_minimum_required(VERSION 3.1)
cmake_minimum_required(VERSION 3.10)

project(TestQtBigint LANGUAGES CXX)
set(CURRENT_PROJECT ${PROJECT_NAME}Test)

include(../CMake/ProjectOut.cmake)

Expand All @@ -17,14 +17,15 @@ set(CMAKE_AUTORCC ON)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

find_package(Qt5 COMPONENTS Core REQUIRED)
find_package(Qt5 COMPONENTS Test REQUIRED)
find_package(Qt5 COMPONENTS Core Test REQUIRED)

file(GLOB SOURCE_CPP
"*.cpp"
)

add_library(${PROJECT_NAME} SHARED ${SOURCE_CPP})
target_link_libraries(${PROJECT_NAME} PRIVATE Qt5::Core Qt5::Test QtBigint)
target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
add_executable(${CURRENT_PROJECT} ${SOURCE_CPP})
target_link_libraries(${CURRENT_PROJECT} PRIVATE Qt5::Core Qt5::Test QtBigint)
target_include_directories(${CURRENT_PROJECT} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})

initTests()
addTests("QtBigint" ${CURRENT_PROJECT})

0 comments on commit 4f8a941

Please sign in to comment.