diff options
author | Betsy McPhail <betsy.mcphail@kitware.com> | 2019-06-18 14:49:40 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2019-06-19 12:57:12 (GMT) |
commit | eef3e020c21d2fdba19aab0daf1b99f8de0a16fe (patch) | |
tree | 30c79204ed261551c611d6f1f159ef682c8b2b74 /Help/guide/tutorial/Step10 | |
parent | 862cfc0e6c3f275db73281f3b9b989704251ab6a (diff) | |
download | CMake-eef3e020c21d2fdba19aab0daf1b99f8de0a16fe.zip CMake-eef3e020c21d2fdba19aab0daf1b99f8de0a16fe.tar.gz CMake-eef3e020c21d2fdba19aab0daf1b99f8de0a16fe.tar.bz2 |
Help: Populate tutorial guide text
Migrate tutorial text from individual `directions.txt` files to the main
tutorial document. Add some comments to source code to provide anchors
for inclusion.
Diffstat (limited to 'Help/guide/tutorial/Step10')
-rw-r--r-- | Help/guide/tutorial/Step10/CMakeLists.txt | 12 | ||||
-rw-r--r-- | Help/guide/tutorial/Step10/MathFunctions/CMakeLists.txt | 2 | ||||
-rw-r--r-- | Help/guide/tutorial/Step10/directions.txt | 38 | ||||
-rw-r--r-- | Help/guide/tutorial/Step10/tutorial.cxx | 1 |
4 files changed, 8 insertions, 45 deletions
diff --git a/Help/guide/tutorial/Step10/CMakeLists.txt b/Help/guide/tutorial/Step10/CMakeLists.txt index 79aadd5..5819272 100644 --- a/Help/guide/tutorial/Step10/CMakeLists.txt +++ b/Help/guide/tutorial/Step10/CMakeLists.txt @@ -1,20 +1,20 @@ cmake_minimum_required(VERSION 3.3) project(Tutorial) +set(CMAKE_CXX_STANDARD 14) + +# Set the version number +set(Tutorial_VERSION_MAJOR 1) +set(Tutorial_VERSION_MINOR 0) + # control where the static and shared libraries are built so that on windows # we don't need to tinker with the path to run the executable set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}") set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}") set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}") -set(CMAKE_CXX_STANDARD 14) - option(BUILD_SHARED_LIBS "Build using shared libraries" ON) -# the version number. -set(Tutorial_VERSION_MAJOR 1) -set(Tutorial_VERSION_MINOR 0) - # configure a header file to pass the version number only configure_file( "${PROJECT_SOURCE_DIR}/TutorialConfig.h.in" diff --git a/Help/guide/tutorial/Step10/MathFunctions/CMakeLists.txt b/Help/guide/tutorial/Step10/MathFunctions/CMakeLists.txt index 7a23505..aafd090 100644 --- a/Help/guide/tutorial/Step10/MathFunctions/CMakeLists.txt +++ b/Help/guide/tutorial/Step10/MathFunctions/CMakeLists.txt @@ -1,4 +1,3 @@ - # add the library that runs add_library(MathFunctions MathFunctions.cxx) @@ -57,5 +56,6 @@ endif() # building on windows target_compile_definitions(MathFunctions PRIVATE "EXPORTING_MYMATH") +# install rules install(TARGETS MathFunctions DESTINATION lib) install(FILES MathFunctions.h DESTINATION include) diff --git a/Help/guide/tutorial/Step10/directions.txt b/Help/guide/tutorial/Step10/directions.txt deleted file mode 100644 index 5317b54..0000000 --- a/Help/guide/tutorial/Step10/directions.txt +++ /dev/null @@ -1,38 +0,0 @@ -# Adding Generator Expressions # - -Generator expressions are evaluated during build system generation to produce -information specific to each build configuration. - -Generator expressions are allowed in the context of many target properties, such -as LINK_LIBRARIES, INCLUDE_DIRECTORIES, COMPILE_DEFINITIONS and others. They may -also be used when using commands to populate those properties, such as -target_link_libraries(), target_include_directories(), -target_compile_definitions() and others. - -Generator expressions may to used to enable conditional linking, conditional -definitions used when compiling, and conditional include directories and more. -The conditions may be based on the build configuration, target properties, -platform information or any other queryable information. - -There are different types of generator expressions including Logical, -Informational, and Output expressions. - -Logical expressions are used to create conditional output. The basic expressions -are the 0 and 1 expressions. A "$<0:...>" results in the empty string, and -"$<1:...>" results in the content of "...". They can also be nested. -For example: - - if(HAVE_LOG AND HAVE_EXP) - target_compile_definitions(SqrtLibrary - PRIVATE "HAVE_LOG" "HAVE_EXP") - endif() - -Can be rewritten with generator expressions: - - target_compile_definitions(SqrtLibrary PRIVATE - "$<$<BOOL:${HAVE_LOG}>:HAVE_LOG>" - "$<$<BOOL:${HAVE_EXP}>:HAVE_EXP>" - ) - -Note that "${HAVE_LOG}" is evaluated at CMake configure time while -"$<$<BOOL:${HAVE_LOG}>:HAVE_LOG>" is evaluated at build system generation time. diff --git a/Help/guide/tutorial/Step10/tutorial.cxx b/Help/guide/tutorial/Step10/tutorial.cxx index 4451cbd..42eaab9 100644 --- a/Help/guide/tutorial/Step10/tutorial.cxx +++ b/Help/guide/tutorial/Step10/tutorial.cxx @@ -9,6 +9,7 @@ int main(int argc, char* argv[]) { if (argc < 2) { + // report version std::cout << argv[0] << " Version " << Tutorial_VERSION_MAJOR << "." << Tutorial_VERSION_MINOR << std::endl; std::cout << "Usage: " << argv[0] << " number" << std::endl; |