Skip to content

Commit 610492c

Browse files
authored
Merge pull request #516 from psychocoderHPC/topic-cmakeBackports2
CMake Test Option and Unified Requirement Backport 0.3.1
2 parents 32a64f0 + 1c9548a commit 610492c

File tree

24 files changed

+24
-30
lines changed

24 files changed

+24
-30
lines changed

CMakeLists.txt

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,26 @@
1919
#
2020

2121
################################################################################
22-
# Required CMake version.
22+
# Required CMake version
2323

24-
CMAKE_MINIMUM_REQUIRED(VERSION 3.7.0)
24+
cmake_minimum_required(VERSION 3.7.0)
2525

26-
PROJECT("alpakaAll")
26+
project("alpakaAll")
27+
28+
################################################################################
29+
# Options and Variants
30+
31+
option(alpaka_BUILD_EXAMPLES "Build the examples" ON)
32+
33+
include(CTest)
34+
# automatically defines: BUILD_TESTING, default is ON
2735

2836
################################################################################
2937
# Add subdirectories.
3038

31-
ADD_SUBDIRECTORY("example/")
32-
ADD_SUBDIRECTORY("test/")
39+
if(alpaka_BUILD_EXAMPLES)
40+
add_subdirectory("example/")
41+
endif()
42+
if(BUILD_TESTING)
43+
add_subdirectory("test/")
44+
endif()

cmake/addExecutable.cmake

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@
1818
# If not, see <http://www.gnu.org/licenses/>.
1919
#
2020

21-
# CUDA_SOURCE_PROPERTY_FORMAT is only supported starting from 3.3.0.
22-
CMAKE_MINIMUM_REQUIRED(VERSION 3.3.0)
21+
CMAKE_MINIMUM_REQUIRED(VERSION 3.7.0)
2322

2423
#------------------------------------------------------------------------------
2524
# Calls CUDA_ADD_EXECUTABLE or ADD_EXECUTABLE depending on the enabled alpaka accelerators.

cmake/addLibrary.cmake

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@
1818
# If not, see <http://www.gnu.org/licenses/>.
1919
#
2020

21-
# CUDA_SOURCE_PROPERTY_FORMAT is only supported starting from 3.3.0.
22-
CMAKE_MINIMUM_REQUIRED(VERSION 3.3.0)
21+
CMAKE_MINIMUM_REQUIRED(VERSION 3.7.0)
2322

2423
#------------------------------------------------------------------------------
2524
# Calls CUDA_ADD_LIBRARY or ADD_LIBRARY depending on the enabled alpaka

example/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
# Required CMake version.
2323
################################################################################
2424

25-
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.12)
25+
CMAKE_MINIMUM_REQUIRED(VERSION 3.7.0)
2626

2727
PROJECT("alpakaExamples")
2828

test/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
# Required CMake version.
2323
################################################################################
2424

25-
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.12)
25+
CMAKE_MINIMUM_REQUIRED(VERSION 3.7.0)
2626

2727
PROJECT("alpakaTest")
2828

test/analysis/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
# Required CMake version.
2323
################################################################################
2424

25-
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.12)
25+
CMAKE_MINIMUM_REQUIRED(VERSION 3.7.0)
2626

2727
PROJECT("alpakaAnalysisTest")
2828

test/analysis/headerCheck/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,5 +106,4 @@ ENDIF()
106106
# Group the targets into subfolders for IDEs supporting this.
107107
SET_TARGET_PROPERTIES(headerCheck PROPERTIES FOLDER "test/analysis")
108108

109-
ENABLE_TESTING()
110109
ADD_TEST(NAME ${_TARGET_NAME} COMMAND ${_TARGET_NAME})

test/integ/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
# Required CMake version.
2323
################################################################################
2424

25-
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.12)
25+
CMAKE_MINIMUM_REQUIRED(VERSION 3.7.0)
2626

2727
PROJECT("alpakaIntegTest")
2828

test/integ/cudaOnly/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,5 +81,4 @@ ENDIF()
8181
# Group the targets into subfolders for IDEs supporting this.
8282
SET_TARGET_PROPERTIES(${_TARGET_NAME} PROPERTIES FOLDER "test/integ")
8383

84-
ENABLE_TESTING()
8584
ADD_TEST(NAME ${_TARGET_NAME} COMMAND ${_TARGET_NAME})

test/unit/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
# Required CMake version.
2323
################################################################################
2424

25-
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.12)
25+
CMAKE_MINIMUM_REQUIRED(VERSION 3.7.0)
2626

2727
PROJECT("alpakaUnitTest")
2828

0 commit comments

Comments
 (0)