mirror of
https://github.com/Kitware/CMake.git
synced 2026-04-23 22:58:37 -05:00
Tutorial: Improve Step 9
* Move USE_MYMATH from configured header to target_compile_definitions
This commit is contained in:
@@ -13,6 +13,8 @@ target_include_directories(MathFunctions
|
||||
option(USE_MYMATH "Use tutorial provided math implementation" ON)
|
||||
if(USE_MYMATH)
|
||||
|
||||
target_compile_definitions(MathFunctions PRIVATE "USE_MYMATH")
|
||||
|
||||
# first we add the executable that generates the table
|
||||
add_executable(MakeTable MakeTable.cxx)
|
||||
|
||||
@@ -34,6 +36,7 @@ if(USE_MYMATH)
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
)
|
||||
|
||||
# state that SqrtLibrary need PIC when the default is shared libraries
|
||||
set_target_properties(SqrtLibrary PROPERTIES
|
||||
POSITION_INDEPENDENT_CODE ${BUILD_SHARED_LIBS}
|
||||
)
|
||||
@@ -41,8 +44,6 @@ if(USE_MYMATH)
|
||||
target_link_libraries(MathFunctions PRIVATE SqrtLibrary)
|
||||
endif()
|
||||
|
||||
target_compile_definitions(MathFunctions PRIVATE "$<$<BOOL:${USE_MYMATH}>:USE_MYMATH>")
|
||||
|
||||
# define the symbol stating we are using the declspec(dllexport) when
|
||||
# building on windows
|
||||
target_compile_definitions(MathFunctions PRIVATE "EXPORTING_MYMATH")
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
// A simple program that computes the square root of a number
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
|
||||
#include "MathFunctions.h"
|
||||
|
||||
Reference in New Issue
Block a user