diff --git a/Common.cmake b/Common.cmake index 6e8d39d..cdcf07a 100644 --- a/Common.cmake +++ b/Common.cmake @@ -148,10 +148,12 @@ include(CommonCompiler) include(CommonCoverage) include(CommonCPackUtils) include(CommonSmokeTest) +if (NOT ${PROJECT_NAME}_IGNORE_GIT) include(GitInfo) include(GitTargets) include(GitHooks) include(ProjectInfo) +endif() if(INSTALL_PACKAGES) include(InstallDependencies) diff --git a/CommonApplication.cmake b/CommonApplication.cmake index 5442802..73894d5 100644 --- a/CommonApplication.cmake +++ b/CommonApplication.cmake @@ -77,8 +77,15 @@ function(common_application Name) endif() endif() - add_executable(${Name} ${_options} ${_icon} ${_desktop} ${_headers} - ${_sources}) + source_group(TREE ${PROJECT_SOURCE_DIR} FILES ${_sources} ${_headers}) + + if (CUDA_FOUND AND ${NAME}_USE_CUDA) + cuda_add_executable(${Name} ${_options} ${_icon} ${_desktop} ${_headers} + ${_sources}) + else() + add_executable(${Name} ${_options} ${_icon} ${_desktop} ${_headers} + ${_sources}) + endif() set_target_properties(${Name} PROPERTIES FOLDER ${PROJECT_NAME}) common_compile_options(${Name}) add_dependencies(${PROJECT_NAME}-all ${Name}) diff --git a/CommonCompiler.cmake b/CommonCompiler.cmake index fec016b..995fa8e 100644 --- a/CommonCompiler.cmake +++ b/CommonCompiler.cmake @@ -11,7 +11,7 @@ # CMake options: # * COMMON_WARN_DEPRECATED: Enable compiler deprecation warnings, default ON # * COMMON_ENABLE_CXX11_STDLIB: Enable C++11 stdlib, default OFF -# * COMMON_DISABLE_WERROR: Disable -Werror flags, default OFF +# * COMMON_DISABLE_WERROR: Disable -Werror flags, default ON # * COMMON_ENABLE_CXX11_ABI: Enable C++11 ABI for gcc 5 or later, default ON, # can be set to OFF with env variable CMAKE_COMMON_USE_CXX03_ABI # @@ -46,7 +46,7 @@ endif() option(COMMON_WARN_DEPRECATED "Enable compiler deprecation warnings" ON) option(COMMON_ENABLE_CXX11_STDLIB "Enable C++11 stdlib" OFF) -option(COMMON_DISABLE_WERROR "Disable -Werror flag" OFF) +option(COMMON_DISABLE_WERROR "Disable -Werror flag" ON) if($ENV{CMAKE_COMMON_USE_CXX03_ABI}) # set by viz/env module option(COMMON_ENABLE_CXX11_ABI "Enable C++11 ABI for gcc 5 or later" OFF) else() @@ -162,9 +162,11 @@ elseif(MSVC) # http://www.ogre3d.org/forums/viewtopic.php?f=2&t=60015&start=0 set(COMMON_CXX_FLAGS /DWIN32 /D_WINDOWS /W3 /Zm500 /EHsc /GR /D_CRT_SECURE_NO_WARNINGS /D_SCL_SECURE_NO_WARNINGS - /W0 ) - set(COMMON_CXX_FLAGS_DEBUG /WX) + + if (NOT COMMON_DISABLE_WERROR) + set(COMMON_CXX_FLAGS /WX) + endif() else() message(FATAL_ERROR "Unknown/unsupported compiler ${CMAKE_CXX_COMPILER_ID}") endif() diff --git a/CommonLibrary.cmake b/CommonLibrary.cmake index f21ccc4..f7df7c9 100644 --- a/CommonLibrary.cmake +++ b/CommonLibrary.cmake @@ -45,7 +45,7 @@ include(CommonCheckTargets) include(InstallFiles) -set(COMMON_LIBRARY_TYPE SHARED CACHE STRING +set(COMMON_LIBRARY_TYPE STATIC CACHE STRING "Library type {any combination of SHARED, STATIC}") set_property(CACHE COMMON_LIBRARY_TYPE PROPERTY STRINGS SHARED STATIC) @@ -87,8 +87,7 @@ function(common_library Name) list(SORT PUBLIC_HEADERS) endif() - source_group(\\ FILES CMakeLists.txt) - source_group(${INCLUDE_NAME} FILES ${SOURCES} ${HEADERS} ${PUBLIC_HEADERS}) + source_group(TREE ${PROJECT_SOURCE_DIR} FILES ${SOURCES} ${HEADERS} ${PUBLIC_HEADERS}) if(NOT ${NAME}_LIBRARY_TYPE) set(${NAME}_LIBRARY_TYPE ${COMMON_LIBRARY_TYPE}) @@ -103,14 +102,19 @@ function(common_library Name) endif() if(NOT ${NAME}_SOURCES) - add_library(${LibName} INTERFACE) + add_library(${LibName} INTERFACE) _target_include_directories(INTERFACE) else() # append a debug suffix to library name on windows or if user requests it common_set_lib_name_postfix() - add_library(${LibName} ${LIBRARY_TYPE} - ${SOURCES} ${HEADERS} ${PUBLIC_HEADERS}) + if (CUDA_FOUND AND ${NAME}_USE_CUDA) + cuda_add_library(${LibName} ${LIBRARY_TYPE} + ${SOURCES} ${HEADERS} ${PUBLIC_HEADERS}) + else() + add_library(${LibName} ${LIBRARY_TYPE} + ${SOURCES} ${HEADERS} ${PUBLIC_HEADERS}) + endif() set_target_properties(${LibName} PROPERTIES VERSION ${${PROJECT_NAME}_VERSION} SOVERSION ${${PROJECT_NAME}_VERSION_ABI} @@ -132,7 +136,7 @@ function(common_library Name) # add an alias with PROJECT_NAME to the target to ease detection of # subproject inclusion in CommonConfig.cmake if(NOT TARGET ${PROJECT_NAME}_ALIAS) - add_library(${PROJECT_NAME}_ALIAS ALIAS ${LibName}) + add_library(${PROJECT_NAME}_ALIAS ALIAS ${LibName}) endif() if(NOT ${NAME}_OMIT_INSTALL)