diff --git a/CMakeLists.txt b/CMakeLists.txt index 32e4375..4ce737c 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,6 +8,7 @@ option(ENABLE_SCA "enable/disable static code analysis." OFF) option(ENABLE_DOC "enable/disable documentation generation." OFF) set(MISRA_C_VERSION 2012 CACHE STRING "MISRA standard.") set(CANTP_CONFIG_FILEPATH ${CMAKE_CURRENT_SOURCE_DIR}/config/can_tp.json CACHE FILEPATH "") +set(OUTPUT_LIB_NAME CanTp CACHE STRING "default library name") find_package(PythonInterp 3.6 REQUIRED) @@ -25,9 +26,9 @@ endif () add_subdirectory(generated) -add_library(${PROJECT_NAME} STATIC source/CanTp.c) +add_library(${OUTPUT_LIB_NAME} STATIC source/CanTp.c) -target_compile_definitions(${PROJECT_NAME} +target_compile_definitions(${OUTPUT_LIB_NAME} PRIVATE CANTP_DEV_ERROR_DETECT=$,STD_ON,STD_OFF> PRIVATE CANTP_SW_VERSION_MAJOR=${PROJECT_VERSION_MAJOR} PRIVATE CANTP_SW_VERSION_MINOR=${PROJECT_VERSION_MINOR} @@ -44,7 +45,7 @@ target_compile_definitions(${PROJECT_NAME} PUBLIC CANTP_READ_PARAMETER_API=STD_ON PUBLIC CANTP_BUILD_CFFI_INTERFACE=$,STD_ON,STD_OFF>) -target_include_directories(${PROJECT_NAME} +target_include_directories(${OUTPUT_LIB_NAME} PUBLIC interface PUBLIC $<$:${CMAKE_CURRENT_SOURCE_DIR}/generated> PUBLIC $<$:${CMAKE_CURRENT_SOURCE_DIR}/test/stub>) @@ -52,7 +53,7 @@ target_include_directories(${PROJECT_NAME} if (${ENABLE_TEST}) ENABLE_TESTing() - target_link_libraries(${PROJECT_NAME} + target_link_libraries(${OUTPUT_LIB_NAME} PUBLIC CanTp_PBcfg) add_test(NAME CanTp_UnitTest diff --git a/README.md b/README.md index 365ce32..60dd2b7 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,7 @@ The following definitions might be set by the user, depending on the needs. | ```ENABLE_SCA``` | ```ON```/```OFF``` | ```OFF``` | enables/disables generation of targets related to static code analysis (should be disabled if [lint](https://www.gimpel.com) software is not available) | | ```MISRA_C_VERSION``` | ```1998```/```2004```/```2012``` | ```2012``` | specifies which version of **MISRA** should be used when performing static code analysis (only used if ```ENABLE_SCA``` is set) | | ```CANTP_CONFIG_FILEPATH``` | ```-``` | ```CanTp/config/can_tp.json``` | specifies which json configuration file should be used to generate the auto-generated code | +| ```OUTPUT_LIB_NAME``` | ```-``` | ```CanTp``` | specifies the library's name | | ```ENABLE_DOC``` | ```ON```/```OFF``` | ```OFF``` | enables/disables generation of [Doxygen](http://www.doxygen.nl/) documentation | To use this feature, simply add ```-D=``` when configuring the build with CMake. diff --git a/config/cffi_config.py.in b/config/cffi_config.py.in index 0cd4819..64e04a7 100644 --- a/config/cffi_config.py.in +++ b/config/cffi_config.py.in @@ -8,8 +8,8 @@ import sys build_directory = "${CMAKE_BINARY_DIR}" header = "${PROJECT_SOURCE_DIR}/interface/CanTp.h" source = "${PROJECT_SOURCE_DIR}/source/CanTp.c" -compile_definitions = "$,$>".split(';') -include_directories = "$,$>".split(';') +compile_definitions = "$,$>".split(';') +include_directories = "$,$>".split(';') sys.path.append("${PROJECT_SOURCE_DIR}/script") sys.path.append(build_directory)