Skip to content
This repository has been archived by the owner on Apr 15, 2020. It is now read-only.

Commit

Permalink
Test 'hunter_check_toolchain_definition' module
Browse files Browse the repository at this point in the history
  • Loading branch information
ruslo committed Dec 22, 2016
1 parent 4f59775 commit ce84ff4
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 0 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Expand Up @@ -54,6 +54,7 @@ env:
- PROJECT_DIR=tests/hunter_sleep_before_download TOOLCHAIN=default
- PROJECT_DIR=tests/hunter_unpack_directory TOOLCHAIN=default
- PROJECT_DIR=tests/hunter_init_not_found_counter TOOLCHAIN=default
- PROJECT_DIR=tests/hunter_check_toolchain_definition TOOLCHAIN=default

- TOOLCHAIN=generate-documentation-test

Expand Down
3 changes: 3 additions & 0 deletions appveyor.yml
Expand Up @@ -65,6 +65,9 @@ environment:
- PROJECT_DIR: tests\hunter_sleep_before_download
TOOLCHAIN: default

- PROJECT_DIR: tests\hunter_check_toolchain_definition
TOOLCHAIN: default

install:
# Python 3
- cmd: set PATH=C:\Python34-x64;C:\Python34-x64\Scripts;%PATH%
Expand Down
43 changes: 43 additions & 0 deletions tests/hunter_check_toolchain_definition/CMakeLists.txt
@@ -0,0 +1,43 @@
# Copyright (c) 2016, Ruslan Baratov
# All rights reserved.

cmake_minimum_required(VERSION 3.0)

include("../../examples/common.cmake")
project(TestModuleHunterCheckToolchainDefinition)

# We should call at least one 'hunter_add_package' to trigger toolchain-id
# calculation
hunter_add_package(Sugar)

include(hunter_check_toolchain_definition)

hunter_check_toolchain_definition(
NAME __cplusplus
DEFINED is_defined
VALUE value
)

if(NOT is_defined)
message(FATAL_ERROR "Not defined")
endif()

string(COMPARE EQUAL "${value}" "" is_empty)
if(is_empty)
message(FATAL_ERROR "Is empty")
endif()

hunter_check_toolchain_definition(
NAME __this_is_not_a_macro
DEFINED is_defined
VALUE value
)

if(is_defined)
message(FATAL_ERROR "Is defined")
endif()

string(COMPARE EQUAL "${value}" "" is_empty)
if(NOT is_empty)
message(FATAL_ERROR "Not empty: '${value}'")
endif()

0 comments on commit ce84ff4

Please sign in to comment.