From b6becce8fb29f9f3d21dd2edc6c0f21474b619bd Mon Sep 17 00:00:00 2001
From: Chris Kitching <chriskitching@linux.com>
Date: Wed, 11 May 2016 01:12:56 +0100
Subject: [PATCH] Don't use variable for the test target name

I'm not sure that using a variable for target names really helps
with clarity. Unlike paths, target names aren't really something
you change. In a sense, targets are themselves a sort of variable,
so having a variable to name a variable seems just a bit gnarly.
---
 CMakeLists.txt | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 05eda647..b51f83ab 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -7,7 +7,6 @@ option(BuildTests "Build the unit tests" ON)
 
 # define project variables
 set(JSON_TARGET_NAME ${PROJECT_NAME})
-set(JSON_UNITTEST_TARGET_NAME "json_unit")
 set(JSON_PACKAGE_NAME ${JSON_TARGET_NAME})
 set(JSON_TARGETS_FILENAME "${JSON_PACKAGE_NAME}Targets.cmake")
 set(JSON_CONFIG_FILENAME "${JSON_PACKAGE_NAME}Config.cmake")
@@ -23,17 +22,17 @@ target_include_directories(${JSON_TARGET_NAME} INTERFACE
 
 # create and configure the unit test target
 if (BuildTests)
-    add_executable(${JSON_UNITTEST_TARGET_NAME}
+    add_executable(json_unit
         "test/catch.hpp"
         "test/unit.cpp"
     )
-    set_target_properties(${JSON_UNITTEST_TARGET_NAME} PROPERTIES
+    set_target_properties(json_unit PROPERTIES
         CXX_STANDARD 11
         CXX_STANDARD_REQUIRED ON
         COMPILE_DEFINITIONS "$<$<CXX_COMPILER_ID:MSVC>:_SCL_SECURE_NO_WARNINGS>"
         COMPILE_OPTIONS "$<$<CXX_COMPILER_ID:MSVC>:/EHsc;$<$<CONFIG:Release>:/Od>>")
-    target_include_directories(${JSON_UNITTEST_TARGET_NAME} PRIVATE "test")
-    target_link_libraries(${JSON_UNITTEST_TARGET_NAME} ${JSON_TARGET_NAME})
+    target_include_directories(json_unit PRIVATE "test")
+    target_link_libraries(json_unit ${JSON_TARGET_NAME})
 endif()
 
 # generate a config and config version file for the package