Permalink
Browse files

minor fixes

  • Loading branch information...
hfcrwx committed Jul 18, 2017
1 parent 57bd867 commit d9c7fdd8bea793f810bfee8b1356c234a8f6ccf6
View
@@ -2,4 +2,3 @@ cmake_minimum_required (VERSION 2.8)
project (Demo1)
add_executable(Demo main.cc)
View

This file was deleted.

Oops, something went wrong.
View
@@ -4,6 +4,8 @@ cmake_minimum_required (VERSION 2.8)
# 项目信息
project (Demo4)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
# 加入一个配置头文件,用于处理 CMake 对源码的设置
configure_file (
"${PROJECT_SOURCE_DIR}/config.h.in"
@@ -18,7 +20,7 @@ option (USE_MYMATH
if (USE_MYMATH)
include_directories ("${PROJECT_SOURCE_DIR}/math")
add_subdirectory (math)
set (EXTRA_LIBS ${EXTRA_LIBS} MathFunctions )
set (EXTRA_LIBS ${EXTRA_LIBS} MathFunctions)
endif (USE_MYMATH)
# 查找当前目录下的所有源文件
View
@@ -1,9 +1,9 @@
#include <stdio.h>
#include <stdlib.h>
#include "config.h"
#include <config.h>
#ifdef USE_MYMATH
#include "math/MathFunctions.h"
#include <MathFunctions.h>
#else
#include <math.h>
#endif
View
@@ -4,6 +4,8 @@ cmake_minimum_required (VERSION 2.8)
# 项目信息
project (Demo5)
set (CMAKE_INCLUDE_CURRENT_DIR ON)
# 加入一个配置头文件,用于处理 CMake 对源码的设置
configure_file (
"${PROJECT_SOURCE_DIR}/config.h.in"
@@ -17,7 +19,7 @@ option (USE_MYMATH
# 是否加入 MathFunctions 库
if (USE_MYMATH)
include_directories ("${PROJECT_SOURCE_DIR}/math")
add_subdirectory (math)
add_subdirectory (math)
set (EXTRA_LIBS ${EXTRA_LIBS} MathFunctions)
endif (USE_MYMATH)
View
@@ -1,9 +1,9 @@
#include <stdio.h>
#include <stdlib.h>
#include "config.h"
#include <config.h>
#ifdef USE_MYMATH
#include "math/MathFunctions.h"
#include <MathFunctions.h>
#else
#include <math.h>
#endif
@@ -6,5 +6,5 @@ aux_source_directory(. DIR_LIB_SRCS)
add_library (MathFunctions ${DIR_LIB_SRCS})
# 指定 MathFunctions 库的安装路径
install (TARGETS MathFunctions DESTINATION bin)
install (TARGETS MathFunctions DESTINATION lib)
install (FILES MathFunctions.h DESTINATION include)
View
@@ -4,6 +4,8 @@ cmake_minimum_required (VERSION 2.8)
# 项目信息
project (Demo6)
set (CMAKE_INCLUDE_CURRENT_DIR ON)
# 检查系统是否支持 pow 函数
include (${CMAKE_ROOT}/Modules/CheckFunctionExists.cmake)
check_function_exists (pow HAVE_POW)
@@ -16,7 +18,8 @@ configure_file (
# 是否加入 MathFunctions 库
if (NOT HAVE_POW)
add_subdirectory (math)
include_directories ("${PROJECT_SOURCE_DIR}/math")
add_subdirectory (math)
set (EXTRA_LIBS ${EXTRA_LIBS} MathFunctions)
endif (NOT HAVE_POW)
View
@@ -1,4 +1,2 @@
// does the platform provide pow function?
#cmakedefine HAVE_POW
#cmakedefine HAVE_LOG
#cmakedefine HAVE_EXP
View
@@ -1,8 +1,12 @@
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "config.h"
#include "math/MathFunctions.h"
#include <config.h>
#ifdef HAVE_POW
#include <math.h>
#else
#include <MathFunctions.h>
#endif
int main(int argc, char *argv[])
{
@@ -13,7 +17,7 @@ int main(int argc, char *argv[])
double base = atof(argv[1]);
int exponent = atoi(argv[2]);
#if defined (HAVE_POW)
#ifdef HAVE_POW
printf("Now we use the standard library. \n");
double result = pow(base, exponent);
#else
@@ -6,5 +6,5 @@ aux_source_directory(. DIR_LIB_SRCS)
add_library (MathFunctions ${DIR_LIB_SRCS})
# 指定 MathFunctions 库的安装路径
install (TARGETS MathFunctions DESTINATION bin)
install (FILES MathFunctions.h DESTINATION include)
install (TARGETS MathFunctions DESTINATION lib)
install (FILES MathFunctions.h DESTINATION include)
View
@@ -5,6 +5,8 @@ project (Demo7)
set (Demo_VERSION_MAJOR 1)
set (Demo_VERSION_MINOR 0)
set (CMAKE_INCLUDE_CURRENT_DIR ON)
# 检查系统是否支持 pow 函数
include (${CMAKE_ROOT}/Modules/CheckFunctionExists.cmake)
check_function_exists (pow HAVE_POW)
@@ -17,6 +19,7 @@ configure_file (
# 是否加入 MathFunctions 库
if (NOT HAVE_POW)
include_directories ("${PROJECT_SOURCE_DIR}/math")
add_subdirectory (math)
set (EXTRA_LIBS ${EXTRA_LIBS} MathFunctions)
endif (NOT HAVE_POW)
View
@@ -4,5 +4,3 @@
// does the platform provide pow function?
#cmakedefine HAVE_POW
#cmakedefine HAVE_LOG
#cmakedefine HAVE_EXP
View
@@ -1,8 +1,12 @@
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "config.h"
#include "math/MathFunctions.h"
#include <config.h>
#ifdef HAVE_POW
#include <math.h>
#else
#include <MathFunctions.h>
#endif
int main(int argc, char *argv[])
{
@@ -18,7 +22,7 @@ int main(int argc, char *argv[])
double base = atof(argv[1]);
int exponent = atoi(argv[2]);
#if defined (HAVE_POW)
#ifdef HAVE_POW
printf("Now we use the standard library. \n");
double result = pow(base, exponent);
#else
@@ -6,5 +6,5 @@ aux_source_directory(. DIR_LIB_SRCS)
add_library (MathFunctions ${DIR_LIB_SRCS})
# 指定 MathFunctions 库的安装路径
install (TARGETS MathFunctions DESTINATION bin)
install (FILES MathFunctions.h DESTINATION include)
install (TARGETS MathFunctions DESTINATION lib)
install (FILES MathFunctions.h DESTINATION include)
View
@@ -5,6 +5,8 @@ project (Demo8)
set (Demo_VERSION_MAJOR 1)
set (Demo_VERSION_MINOR 0)
set (CMAKE_INCLUDE_CURRENT_DIR ON)
# 检查系统是否支持 pow 函数
include (${CMAKE_ROOT}/Modules/CheckFunctionExists.cmake)
check_function_exists (pow HAVE_POW)
@@ -17,6 +19,7 @@ configure_file (
# 是否加入 MathFunctions 库
if (NOT HAVE_POW)
include_directories ("${PROJECT_SOURCE_DIR}/math")
add_subdirectory (math)
set (EXTRA_LIBS ${EXTRA_LIBS} MathFunctions)
endif (NOT HAVE_POW)
@@ -63,4 +66,4 @@ set (CPACK_RESOURCE_FILE_LICENSE
"${CMAKE_CURRENT_SOURCE_DIR}/License.txt")
set (CPACK_PACKAGE_VERSION_MAJOR "${Demo_VERSION_MAJOR}")
set (CPACK_PACKAGE_VERSION_MINOR "${Demo_VERSION_MINOR}")
include (CPack)
include (CPack)
View
@@ -4,5 +4,3 @@
// does the platform provide pow function?
#cmakedefine HAVE_POW
#cmakedefine HAVE_LOG
#cmakedefine HAVE_EXP
Oops, something went wrong.

0 comments on commit d9c7fdd

Please sign in to comment.