diff options
81 files changed, 324 insertions, 490 deletions
diff --git a/Help/manual/cmake-generator-expressions.7.rst b/Help/manual/cmake-generator-expressions.7.rst index bddb174..dc5621a 100644 --- a/Help/manual/cmake-generator-expressions.7.rst +++ b/Help/manual/cmake-generator-expressions.7.rst @@ -97,7 +97,7 @@ Available logical expressions are: compile features and a list of supported compilers. ``$<COMPILE_LANGUAGE:lang>`` ``1`` when the language used for compilation unit matches ``lang``, - otherwise ``0``. This expression used to specify compile options for + otherwise ``0``. This expression may be used to specify compile options for source files of a particular language in a target. For example, to specify the use of the ``-fno-exceptions`` compile option (compiler id checks elided): @@ -109,10 +109,12 @@ Available logical expressions are: PRIVATE $<$<COMPILE_LANGUAGE:CXX>:-fno-exceptions> ) - This generator expression has limited use because it is not possible to - use it with the Visual Studio generators. Portable buildsystems would - not use this expression, and would create separate libraries for each - source file language instead: + Note that with :ref:`Visual Studio Generators` there is no way to represent + target-wide flags separately for ``C`` and ``CXX`` languages. Under these + generators, target-wide flags for both C and C++ sources will be evaluated + using ``CXX`` if there are any C++ sources and otherwise using ``C``. + A workaround is to create separate libraries for each source file language + instead: .. code-block:: cmake diff --git a/Help/manual/cmake-server.7.rst b/Help/manual/cmake-server.7.rst index ee8fada..c2aef99 100644 --- a/Help/manual/cmake-server.7.rst +++ b/Help/manual/cmake-server.7.rst @@ -486,6 +486,8 @@ Each target object can have the following keys: contains the current source directory. "buildDirectory" contains the current build directory. +"isGeneratorProvided" + true if the target is auto-created by a generator, false otherwise "hasInstallRule" true if the target contains any install rules, false otherwise. "installPaths" @@ -656,25 +658,8 @@ Each project object can have the following keys: "name" contains the (sub-)projects name. -"targets" - contains a list of build system target objects. - -Target objects define individual build targets for a certain configuration. - -Each target object can have the following keys: - -"name" - contains the name of the target. -"type" - defines the type of build of the target. Possible values are - "STATIC_LIBRARY", "MODULE_LIBRARY", "SHARED_LIBRARY", "OBJECT_LIBRARY", - "EXECUTABLE", "UTILITY" and "INTERFACE_LIBRARY". -"fullName" - contains the full name of the build result (incl. extensions, etc.). -"hasEnabledTests" - true if testing is enabled for this target. "ctestInfo" - contains a list of test objects for this target. + contains a list of test objects. Each test object can have the following keys: diff --git a/Help/prop_tgt/LANG_COMPILER_LAUNCHER.rst b/Help/prop_tgt/LANG_COMPILER_LAUNCHER.rst index 28925fc..b63d6d7 100644 --- a/Help/prop_tgt/LANG_COMPILER_LAUNCHER.rst +++ b/Help/prop_tgt/LANG_COMPILER_LAUNCHER.rst @@ -2,7 +2,7 @@ ------------------------ This property is implemented only when ``<LANG>`` is ``C``, ``CXX``, -or ``CUDA``. +``Fortran``, or ``CUDA``. Specify a :ref:`;-list <CMake Language Lists>` containing a command line for a compiler launching tool. The :ref:`Makefile Generators` and the diff --git a/Help/release/dev/extend-compile-language-genex.rst b/Help/release/dev/extend-compile-language-genex.rst new file mode 100644 index 0000000..0a0a669 --- /dev/null +++ b/Help/release/dev/extend-compile-language-genex.rst @@ -0,0 +1,7 @@ +extend-compile-language-genex +----------------------------- + +* The ``COMPILE_LANGUAGE`` :manual:`generator expression + <cmake-generator-expressions(7)>` may now be used with + :ref:`Visual Studio Generators` in :prop_tgt:`COMPILE_OPTIONS` + and :command:`file(GENERATE)`. diff --git a/Help/release/dev/fortran-compiler-launcher.rst b/Help/release/dev/fortran-compiler-launcher.rst new file mode 100644 index 0000000..ce254f1 --- /dev/null +++ b/Help/release/dev/fortran-compiler-launcher.rst @@ -0,0 +1,8 @@ +fortran-compiler-launcher +------------------------- + +* The :ref:`Makefile Generators` and the :generator:`Ninja` generator learned + to add compiler launcher tools along with the compiler for the ``Fortran`` + language (``C``, ``CXX``, and ``CUDA`` were supported previously). + See the :variable:`CMAKE_<LANG>_COMPILER_LAUNCHER` variable and + :prop_tgt:`<LANG>_COMPILER_LAUNCHER` target property for details. diff --git a/Help/variable/CMAKE_LANG_COMPILER_LAUNCHER.rst b/Help/variable/CMAKE_LANG_COMPILER_LAUNCHER.rst index f4e2ba5..e6c8bb5 100644 --- a/Help/variable/CMAKE_LANG_COMPILER_LAUNCHER.rst +++ b/Help/variable/CMAKE_LANG_COMPILER_LAUNCHER.rst @@ -3,4 +3,5 @@ CMAKE_<LANG>_COMPILER_LAUNCHER Default value for :prop_tgt:`<LANG>_COMPILER_LAUNCHER` target property. This variable is used to initialize the property on each target as it is -created. This is done only when ``<LANG>`` is ``C``, ``CXX``, or ``CUDA``. +created. This is done only when ``<LANG>`` is ``C``, ``CXX``, ``Fortran``, +or ``CUDA``. diff --git a/Modules/FindAVIFile.cmake b/Modules/FindAVIFile.cmake index 88a2a25..2df29ca 100644 --- a/Modules/FindAVIFile.cmake +++ b/Modules/FindAVIFile.cmake @@ -21,14 +21,8 @@ if (UNIX) - find_path(AVIFILE_INCLUDE_DIR avifile.h - /usr/local/avifile/include - /usr/local/include/avifile - ) - - find_library(AVIFILE_AVIPLAY_LIBRARY aviplay - /usr/local/avifile/lib - ) + find_path(AVIFILE_INCLUDE_DIR avifile.h PATH_SUFFIXES avifile/include include/avifile include/avifile-0.7) + find_library(AVIFILE_AVIPLAY_LIBRARY aviplay aviplay-0.7 PATH_SUFFIXES avifile/lib) endif () diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake index 8708938..9ea8136 100644 --- a/Modules/FindCUDA.cmake +++ b/Modules/FindCUDA.cmake @@ -666,8 +666,7 @@ if(NOT CUDA_TOOLKIT_ROOT_DIR AND NOT CMAKE_CROSSCOMPILING) find_path(CUDA_TOOLKIT_ROOT_DIR NAMES nvcc nvcc.exe PATHS /opt/cuda/bin - /usr/local/bin - /usr/local/cuda/bin + PATH_SUFFIXES cuda/bin DOC "Toolkit location." ) diff --git a/Modules/FindFLTK.cmake b/Modules/FindFLTK.cmake index e6bd3c9..1aa52cc 100644 --- a/Modules/FindFLTK.cmake +++ b/Modules/FindFLTK.cmake @@ -114,12 +114,11 @@ if(NOT FLTK_DIR) # Look in places relative to the system executable search path. ${FLTK_DIR_SEARCH} - PATHS - # Look in standard UNIX install locations. - /usr/local/lib/fltk - /usr/lib/fltk - /usr/local/fltk - /usr/X11R6/include + PATH_SUFFIXES + fltk + fltk/include + lib/fltk + lib/fltk/include # Help the user find it if we cannot. DOC "The ${FLTK_DIR_STRING}" @@ -216,14 +215,11 @@ endif() endif() endif() - set(FLTK_INCLUDE_SEARCH_PATH ${FLTK_INCLUDE_SEARCH_PATH} - /usr/local/fltk - /usr/X11R6/include - ${_FLTK_POSSIBLE_INCLUDE_DIRS} - ) + list(APPEND FLTK_INCLUDE_SEARCH_PATH ${_FLTK_POSSIBLE_INCLUDE_DIRS}) find_path(FLTK_INCLUDE_DIR NAMES FL/Fl.h FL/Fl.H # fltk 1.1.9 has Fl.H (#8376) + PATH_SUFFIXES fltk fltk/include PATHS ${FLTK_INCLUDE_SEARCH_PATH}) # @@ -237,21 +233,16 @@ endif() endif() endif() - set(FLTK_LIBRARY_SEARCH_PATH ${FLTK_LIBRARY_SEARCH_PATH} - /usr/local/fltk/lib - /usr/X11R6/lib - ${FLTK_INCLUDE_DIR}/lib - ${_FLTK_POSSIBLE_LIBRARY_DIR} - ) + list(APPEND FLTK_LIBRARY_SEARCH_PATH ${FLTK_INCLUDE_DIR}/lib ${_FLTK_POSSIBLE_LIBRARY_DIR}) find_library(FLTK_BASE_LIBRARY NAMES fltk fltkd - PATHS ${FLTK_LIBRARY_SEARCH_PATH}) + PATHS ${FLTK_LIBRARY_SEARCH_PATH} PATH_SUFFIXES fltk fltk/lib) find_library(FLTK_GL_LIBRARY NAMES fltkgl fltkgld fltk_gl - PATHS ${FLTK_LIBRARY_SEARCH_PATH}) + PATHS ${FLTK_LIBRARY_SEARCH_PATH} PATH_SUFFIXES fltk fltk/lib) find_library(FLTK_FORMS_LIBRARY NAMES fltkforms fltkformsd fltk_forms - PATHS ${FLTK_LIBRARY_SEARCH_PATH}) + PATHS ${FLTK_LIBRARY_SEARCH_PATH} PATH_SUFFIXES fltk fltk/lib) find_library(FLTK_IMAGES_LIBRARY NAMES fltkimages fltkimagesd fltk_images - PATHS ${FLTK_LIBRARY_SEARCH_PATH}) + PATHS ${FLTK_LIBRARY_SEARCH_PATH} PATH_SUFFIXES fltk fltk/lib) # Find the extra libraries needed for the fltk_images library. if(UNIX) diff --git a/Modules/FindFLTK2.cmake b/Modules/FindFLTK2.cmake index a43e5ff..365a82a 100644 --- a/Modules/FindFLTK2.cmake +++ b/Modules/FindFLTK2.cmake @@ -80,11 +80,11 @@ if(NOT FLTK2_DIR) # Look in places relative to the system executable search path. ${FLTK2_DIR_SEARCH} - # Look in standard UNIX install locations. - /usr/local/lib/fltk2 - /usr/lib/fltk2 - /usr/local/fltk2 - /usr/X11R6/include + PATH_SUFFIXES + fltk2 + fltk2/include + lib/fltk2 + lib/fltk2/include # Help the user find it if we cannot. DOC "The ${FLTK2_DIR_STRING}" @@ -175,25 +175,16 @@ if(FLTK2_DIR) set(FLTK2_WRAP_UI 1) endif() - set(FLTK2_INCLUDE_SEARCH_PATH ${FLTK2_INCLUDE_SEARCH_PATH} - /usr/local/fltk2 - /usr/X11R6/include - ) - - find_path(FLTK2_INCLUDE_DIR fltk/run.h ${FLTK2_INCLUDE_SEARCH_PATH}) + find_path(FLTK2_INCLUDE_DIR fltk/run.h ${FLTK2_INCLUDE_SEARCH_PATH} PATH_SUFFIXES fltk2 fltk2/include) - set(FLTK2_LIBRARY_SEARCH_PATH ${FLTK2_LIBRARY_SEARCH_PATH} - /usr/local/fltk2/lib - /usr/X11R6/lib - ${FLTK2_INCLUDE_DIR}/lib - ) + list(APPEND FLTK2_LIBRARY_SEARCH_PATH ${FLTK2_INCLUDE_DIR}/lib) find_library(FLTK2_BASE_LIBRARY NAMES fltk2 - PATHS ${FLTK2_LIBRARY_SEARCH_PATH}) + PATHS ${FLTK2_LIBRARY_SEARCH_PATH} PATH_SUFFIXES fltk2 fltk2/lib) find_library(FLTK2_GL_LIBRARY NAMES fltk2_gl - PATHS ${FLTK2_LIBRARY_SEARCH_PATH}) + PATHS ${FLTK2_LIBRARY_SEARCH_PATH} PATH_SUFFIXES fltk2 fltk2/lib) find_library(FLTK2_IMAGES_LIBRARY NAMES fltk2_images - PATHS ${FLTK2_LIBRARY_SEARCH_PATH}) + PATHS ${FLTK2_LIBRARY_SEARCH_PATH} PATH_SUFFIXES fltk2 fltk2/lib) # Find the extra libraries needed for the fltk_images library. if(UNIX) diff --git a/Modules/FindFreetype.cmake b/Modules/FindFreetype.cmake index 2acb4bc..61643be 100644 --- a/Modules/FindFreetype.cmake +++ b/Modules/FindFreetype.cmake @@ -63,10 +63,6 @@ set(FREETYPE_FIND_ARGS HINTS ENV FREETYPE_DIR PATHS - /usr/X11R6 - /usr/local/X11R6 - /usr/local/X11 - /usr/freeware ENV GTKMM_BASEPATH [HKEY_CURRENT_USER\\SOFTWARE\\gtkmm\\2.4;Path] [HKEY_LOCAL_MACHINE\\SOFTWARE\\gtkmm\\2.4;Path] diff --git a/Modules/FindGDAL.cmake b/Modules/FindGDAL.cmake index 0cce9cb..ceb8eee 100644 --- a/Modules/FindGDAL.cmake +++ b/Modules/FindGDAL.cmake @@ -49,14 +49,6 @@ find_path(GDAL_INCLUDE_DIR gdal.h PATH_SUFFIXES include/gdal include/GDAL - include - PATHS - ~/Library/Frameworks/gdal.framework/Headers - /Library/Frameworks/gdal.framework/Headers - /sw # Fink - /opt/local # DarwinPorts - /opt/csw # Blastwave - /opt ) if(UNIX) @@ -68,12 +60,6 @@ if(UNIX) HINTS ENV GDAL_DIR ENV GDAL_ROOT - PATH_SUFFIXES bin - PATHS - /sw # Fink - /opt/local # DarwinPorts - /opt/csw # Blastwave - /opt ) if(GDAL_CONFIG) @@ -93,13 +79,6 @@ find_library(GDAL_LIBRARY ENV GDAL_DIR ENV GDAL_ROOT ${_gdal_libpath} - PATH_SUFFIXES lib - PATHS - /sw - /opt/local - /opt/csw - /opt - /usr/freeware ) include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) diff --git a/Modules/FindGIF.cmake b/Modules/FindGIF.cmake index 0843d5f..4b2f882 100644 --- a/Modules/FindGIF.cmake +++ b/Modules/FindGIF.cmake @@ -30,10 +30,6 @@ find_path(GIF_INCLUDE_DIR gif_lib.h HINTS ENV GIF_DIR - PATH_SUFFIXES include - PATHS - ~/Library/Frameworks - /usr/freeware ) # the gif library can have many names :-/ @@ -43,10 +39,6 @@ find_library(GIF_LIBRARY NAMES ${POTENTIAL_GIF_LIBS} HINTS ENV GIF_DIR - PATH_SUFFIXES lib - PATHS - ~/Library/Frameworks - /usr/freeware ) # see readme.txt diff --git a/Modules/FindGTK.cmake b/Modules/FindGTK.cmake index 8a89cda..89fb54b 100644 --- a/Modules/FindGTK.cmake +++ b/Modules/FindGTK.cmake @@ -31,20 +31,17 @@ if(UNIX) # - Atanas Georgiev <atanas@cs.columbia.edu> find_path( GTK_glibconfig_INCLUDE_PATH NAMES glibconfig.h + PATH_SUFFIXES glib/include lib/glib/include include/glib12 PATHS /usr/openwin/share/include - /usr/local/include/glib12 - /usr/lib/glib/include - /usr/local/lib/glib/include /opt/gnome/include /opt/gnome/lib/glib/include ) find_path( GTK_glib_INCLUDE_PATH NAMES glib.h - PATH_SUFFIXES gtk-1.2 glib-1.2 glib12 + PATH_SUFFIXES gtk-1.2 glib-1.2 glib12 glib/include lib/glib/include PATHS /usr/openwin/share/include - /usr/lib/glib/include /opt/gnome/include ) diff --git a/Modules/FindGTK2.cmake b/Modules/FindGTK2.cmake index b87b9f3..8d0da51 100644 --- a/Modules/FindGTK2.cmake +++ b/Modules/FindGTK2.cmake @@ -298,8 +298,6 @@ function(_GTK2_FIND_INCLUDE_DIR _var _hdr) /usr/libx32 /usr/lib64 /usr/lib - /usr/X11R6/include - /usr/X11R6/lib /opt/gnome/include /opt/gnome/lib /opt/openwin/include diff --git a/Modules/FindJNI.cmake b/Modules/FindJNI.cmake index 96e3e21..c4601a1 100644 --- a/Modules/FindJNI.cmake +++ b/Modules/FindJNI.cmake @@ -126,8 +126,6 @@ list(APPEND JAVA_AWT_LIBRARY_DIRECTORIES "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\${java_install_version};JavaHome]/lib" ) JAVA_APPEND_LIBRARY_DIRECTORIES(JAVA_AWT_LIBRARY_DIRECTORIES - /usr/lib - /usr/local/lib /usr/lib/jvm/java/lib /usr/lib/java/jre/lib/{libarch} /usr/lib/jvm/jre/lib/{libarch} @@ -185,8 +183,6 @@ list(APPEND JAVA_AWT_INCLUDE_DIRECTORIES ) JAVA_APPEND_LIBRARY_DIRECTORIES(JAVA_AWT_INCLUDE_DIRECTORIES - /usr/include - /usr/local/include /usr/lib/java/include /usr/local/lib/java/include /usr/lib/jvm/java/include diff --git a/Modules/FindKDE3.cmake b/Modules/FindKDE3.cmake index 03216a5..daf6818 100644 --- a/Modules/FindKDE3.cmake +++ b/Modules/FindKDE3.cmake @@ -200,8 +200,7 @@ find_path(KDE3_INCLUDE_DIR kpassdlg.h PATHS /opt/kde3/include /opt/kde/include - /usr/include/kde - /usr/local/include/kde + PATH_SUFFIXES include/kde ) #now the KDE library directory diff --git a/Modules/FindMPEG.cmake b/Modules/FindMPEG.cmake index cd1b021..850a57e 100644 --- a/Modules/FindMPEG.cmake +++ b/Modules/FindMPEG.cmake @@ -22,23 +22,21 @@ # MPEG_mpeg2_LIBRARY, where to find the MPEG library. # MPEG_vo_LIBRARY, where to find the vo library. -find_path(MPEG_INCLUDE_DIR mpeg2dec/include/video_out.h - /usr/local/livid -) +find_path(MPEG_INCLUDE_DIR + NAMES mpeg2.h mpeg2dec/mpeg2.h mpeg2dec/include/video_out.h) -find_library(MPEG_mpeg2_LIBRARY mpeg2 - /usr/local/livid/mpeg2dec/libmpeg2/.libs -) +find_library(MPEG_mpeg2_LIBRARY mpeg2) -find_library( MPEG_vo_LIBRARY vo - /usr/local/livid/mpeg2dec/libvo/.libs -) +find_library(MPEG_vo_LIBRARY vo) include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(MPEG DEFAULT_MSG MPEG_INCLUDE_DIR MPEG_mpeg2_LIBRARY MPEG_vo_LIBRARY) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(MPEG DEFAULT_MSG MPEG_mpeg2_LIBRARY MPEG_INCLUDE_DIR) if(MPEG_FOUND) - set( MPEG_LIBRARIES ${MPEG_mpeg2_LIBRARY} ${MPEG_vo_LIBRARY} ) + set( MPEG_LIBRARIES ${MPEG_mpeg2_LIBRARY} ) + if(MPEG_vo_LIBRARY) + list(APPEND MPEG2_LIBRARIES ${MPEG_vo_LIBRARY}) + endif() endif() mark_as_advanced(MPEG_INCLUDE_DIR MPEG_mpeg2_LIBRARY MPEG_vo_LIBRARY) diff --git a/Modules/FindMPEG2.cmake b/Modules/FindMPEG2.cmake index 2c75d7b..f9ccd6a 100644 --- a/Modules/FindMPEG2.cmake +++ b/Modules/FindMPEG2.cmake @@ -23,28 +23,24 @@ # MPEG2_vo_LIBRARY, where to find the vo library. find_path(MPEG2_INCLUDE_DIR - NAMES mpeg2.h mpeg2dec/mpeg2.h - PATHS /usr/local/livid -) + NAMES mpeg2.h mpeg2dec/mpeg2.h) -find_library(MPEG2_mpeg2_LIBRARY mpeg2 - /usr/local/livid/mpeg2dec/libmpeg2/.libs -) +find_library(MPEG2_mpeg2_LIBRARY mpeg2) -find_library( MPEG2_vo_LIBRARY vo - /usr/local/livid/mpeg2dec/libvo/.libs -) +find_library(MPEG2_vo_LIBRARY vo) include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) FIND_PACKAGE_HANDLE_STANDARD_ARGS(MPEG2 DEFAULT_MSG MPEG2_mpeg2_LIBRARY MPEG2_INCLUDE_DIR) if(MPEG2_FOUND) - set( MPEG2_LIBRARIES ${MPEG2_mpeg2_LIBRARY} - ${MPEG2_vo_LIBRARY}) + set(MPEG2_LIBRARIES ${MPEG2_mpeg2_LIBRARY}) + if(MPEG2_vo_LIBRARY) + list(APPEND MPEG2_LIBRARIES ${MPEG2_vo_LIBRARY}) + endif() #some native mpeg2 installations will depend #on libSDL, if found, add it in. - include(${CMAKE_CURRENT_LIST_DIR}/FindSDL.cmake) + find_package(SDL) if(SDL_FOUND) set( MPEG2_LIBRARIES ${MPEG2_LIBRARIES} ${SDL_LIBRARY}) endif() diff --git a/Modules/FindOpenGL.cmake b/Modules/FindOpenGL.cmake index 91db5af..9ccd46b 100644 --- a/Modules/FindOpenGL.cmake +++ b/Modules/FindOpenGL.cmake @@ -184,7 +184,7 @@ else() find_path(OPENGL_INCLUDE_DIR GL/gl.h /usr/share/doc/NVIDIA_GLX-1.0/include /usr/openwin/share/include - /opt/graphics/OpenGL/include /usr/X11R6/include + /opt/graphics/OpenGL/include ${_OPENGL_INCLUDE_PATH} ) find_path(OPENGL_GLX_INCLUDE_DIR GL/glx.h ${_OPENGL_INCLUDE_PATH}) @@ -192,21 +192,19 @@ else() find_path(OPENGL_xmesa_INCLUDE_DIR GL/xmesa.h /usr/share/doc/NVIDIA_GLX-1.0/include /usr/openwin/share/include - /opt/graphics/OpenGL/include /usr/X11R6/include + /opt/graphics/OpenGL/include ) # Search for the GLVND libraries. We do this regardless of COMPONENTS; we'll # take into account the COMPONENTS logic later. find_library(OPENGL_opengl_LIBRARY NAMES OpenGL - PATHS /usr/X11R6/lib - ${_OPENGL_LIB_PATH} + PATHS ${_OPENGL_LIB_PATH} ) find_library(OPENGL_glx_LIBRARY NAMES GLX - PATHS /usr/X11R6/lib - ${_OPENGL_LIB_PATH} + PATHS ${_OPENGL_LIB_PATH} ) find_library(OPENGL_egl_LIBRARY @@ -219,7 +217,7 @@ else() PATHS ${OPENGL_gl_LIBRARY} /opt/graphics/OpenGL/lib /usr/openwin/lib - /usr/shlib /usr/X11R6/lib + /usr/shlib ) set(_OpenGL_GL_POLICY_WARN 0) @@ -264,7 +262,7 @@ else() NAMES GL MesaGL PATHS /opt/graphics/OpenGL/lib /usr/openwin/lib - /usr/shlib /usr/X11R6/lib + /usr/shlib ${_OPENGL_LIB_PATH} ) endif() @@ -352,7 +350,7 @@ else() PATHS ${OPENGL_gl_LIBRARY} /opt/graphics/OpenGL/lib /usr/openwin/lib - /usr/shlib /usr/X11R6/lib + /usr/shlib ) endif () diff --git a/Modules/FindOpenThreads.cmake b/Modules/FindOpenThreads.cmake index 54804b8..b1b116a 100644 --- a/Modules/FindOpenThreads.cmake +++ b/Modules/FindOpenThreads.cmake @@ -58,13 +58,6 @@ find_path(OPENTHREADS_INCLUDE_DIR OpenThreads/Thread ENV OSG_ROOT ${OPENTHREADS_DIR} ${OSG_DIR} - PATHS - /sw # Fink - /opt/local # DarwinPorts - /opt/csw # Blastwave - /opt - /usr/freeware - PATH_SUFFIXES include ) @@ -80,13 +73,6 @@ find_library(OPENTHREADS_LIBRARY ENV OSG_ROOT ${OPENTHREADS_DIR} ${OSG_DIR} - PATHS - /sw - /opt/local - /opt/csw - /opt - /usr/freeware - PATH_SUFFIXES lib ) find_library(OPENTHREADS_LIBRARY_DEBUG @@ -102,13 +88,6 @@ find_library(OPENTHREADS_LIBRARY_DEBUG ENV OSG_ROOT ${OPENTHREADS_DIR} ${OSG_DIR} - PATHS - /sw - /opt/local - /opt/csw - /opt - /usr/freeware - PATH_SUFFIXES lib ) if(OPENTHREADS_LIBRARY_DEBUG) diff --git a/Modules/FindPNG.cmake b/Modules/FindPNG.cmake index dceb6bc..936f01f 100644 --- a/Modules/FindPNG.cmake +++ b/Modules/FindPNG.cmake @@ -51,9 +51,7 @@ endif() find_package(ZLIB ${_FIND_ZLIB_ARG}) if(ZLIB_FOUND) - find_path(PNG_PNG_INCLUDE_DIR png.h - /usr/local/include/libpng # OpenBSD - ) + find_path(PNG_PNG_INCLUDE_DIR png.h PATH_SUFFIXES include/libpng) list(APPEND PNG_NAMES png libpng) unset(PNG_NAMES_DEBUG) diff --git a/Modules/FindPike.cmake b/Modules/FindPike.cmake index dff55a4..ec71c94 100644 --- a/Modules/FindPike.cmake +++ b/Modules/FindPike.cmake @@ -16,15 +16,12 @@ # PIKE_INCLUDE_PATH = path to where program.h is found # PIKE_EXECUTABLE = full path to the pike binary -file(GLOB PIKE_POSSIBLE_INCLUDE_PATHS - /usr/include/pike/* - /usr/local/include/pike/*) - find_path(PIKE_INCLUDE_PATH program.h - ${PIKE_POSSIBLE_INCLUDE_PATHS}) + ${PIKE_POSSIBLE_INCLUDE_PATHS} + PATH_SUFFIXES include/pike8.0/pike include/pike7.8/pike include/pike7.4/pike) find_program(PIKE_EXECUTABLE - NAMES pike7.4 + NAMES pike8.0 pike 7.8 pike7.4 ) mark_as_advanced( diff --git a/Modules/FindQt.cmake b/Modules/FindQt.cmake index 4d8aea9..68dfa7d 100644 --- a/Modules/FindQt.cmake +++ b/Modules/FindQt.cmake @@ -105,13 +105,11 @@ find_file( QT4_QGLOBAL_H_FILE qglobal.h "[HKEY_CURRENT_USER\\Software\\Trolltech\\Versions\\4.0.0;InstallDir]/include/Qt" ${qt_headers}/Qt $ENV{QTDIR}/include/Qt - /usr/local/qt/include/Qt - /usr/local/include/Qt /usr/lib/qt/include/Qt - /usr/include/Qt /usr/share/qt4/include/Qt /usr/local/include/X11/qt4/Qt - C:/Progra~1/qt/include/Qt ) + C:/Progra~1/qt/include/Qt + PATH_SUFFIXES qt/include/Qt include/Qt) if(QT4_QGLOBAL_H_FILE) set(QT4_INSTALLED TRUE) @@ -125,14 +123,10 @@ find_file( QT3_QGLOBAL_H_FILE qglobal.h C:/Qt/3.3.3Educational/include $ENV{QTDIR}/include /usr/include/qt3/Qt - /usr/local/qt/include - /usr/local/include - /usr/lib/qt/include - /usr/include /usr/share/qt3/include /usr/local/include/X11/qt3 C:/Progra~1/qt/include - /usr/include/qt3 ) + PATH_SUFFIXES qt/include include/qt3) if(QT3_QGLOBAL_H_FILE) set(QT3_INSTALLED TRUE) diff --git a/Modules/FindQt3.cmake b/Modules/FindQt3.cmake index fa9f3a1..a034210 100644 --- a/Modules/FindQt3.cmake +++ b/Modules/FindQt3.cmake @@ -61,14 +61,10 @@ find_path(QT_INCLUDE_DIR qt.h "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.1.0;InstallDir]/include/Qt" $ENV{QTDIR}/include ${GLOB_PATHS} - /usr/local/qt/include - /usr/lib/qt/include - /usr/lib/qt3/include - /usr/include/qt /usr/share/qt3/include C:/Progra~1/qt/include - /usr/include/qt3 /usr/local/include/X11/qt3 + PATH_SUFFIXES lib/qt/include lib/qt3/include include/qt include/qt3 qt/include qt3/include ) # if qglobal.h is not in the qt_include_dir then set @@ -101,13 +97,10 @@ if (QT_MT_REQUIRED) "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.1.0;InstallDir]" ENV QTDIR ${GLOB_PATHS_LIB} - /usr/local/qt - /usr/lib/qt - /usr/lib/qt3 /usr/share/qt3 C:/Progra~1/qt PATH_SUFFIXES - lib + lib/qt lib/qt3 qt qt3 qt/lib qt3/lib ) else () @@ -122,13 +115,10 @@ else () "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.1.0;InstallDir]" ENV QTDIR ${GLOB_PATHS_LIB} - /usr/local/qt - /usr/lib/qt - /usr/lib/qt3 /usr/share/qt3 C:/Progra~1/qt/lib PATH_SUFFIXES - lib + lib/qt lib/qt3 qt qt3 qt/lib qt3/lib ) endif () @@ -141,12 +131,10 @@ find_library(QT_QASSISTANTCLIENT_LIBRARY "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.1.0;InstallDir]" ENV QTDIR ${GLOB_PATHS_LIB} - /usr/local/qt - /usr/lib/qt3 /usr/share/qt3 C:/Progra~1/qt PATH_SUFFIXES - lib + lib/qt lib/qt3 qt qt3 qt/lib qt3/lib ) # Qt 3 should prefer QTDIR over the PATH @@ -159,15 +147,10 @@ find_program(QT_MOC_EXECUTABLE "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.2.0;InstallDir]/include/Qt" "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.1.0;InstallDir]/include/Qt" ${GLOB_PATHS_BIN} - /usr/local/lib/qt3 - /usr/local/qt - /usr/lib/qt - /usr/lib/qt3 /usr/share/qt3 C:/Progra~1/qt - /usr/X11R6 PATH_SUFFIXES - bin + lib/qt lib/qt3 qt qt3 qt/lib qt3/lib ) if(QT_MOC_EXECUTABLE) @@ -184,14 +167,10 @@ find_program(QT_UIC_EXECUTABLE "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.2.0;InstallDir]/include/Qt" "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.1.0;InstallDir]/include/Qt" ${GLOB_PATHS_BIN} - /usr/local/qt - /usr/lib/qt - /usr/lib/qt3 /usr/share/qt3 C:/Progra~1/qt - /usr/X11R6 PATH_SUFFIXES - bin + lib/qt lib/qt3 qt qt3 qt/lib qt3/lib ) if(QT_UIC_EXECUTABLE) @@ -208,8 +187,6 @@ if (WIN32) PATHS "$ENV{ProgramFiles}/qt" "C:/Program Files/qt" - PATH_SUFFIXES - lib DOC "This Library is only needed by and included with Qt3 on MSWindows. It should be NOTFOUND, undefined or IGNORE otherwise." ) endif () diff --git a/Modules/FindSelfPackers.cmake b/Modules/FindSelfPackers.cmake index 01d0641..ac2c7cf 100644 --- a/Modules/FindSelfPackers.cmake +++ b/Modules/FindSelfPackers.cmake @@ -20,19 +20,11 @@ include(${CMAKE_CURRENT_LIST_DIR}/FindCygwin.cmake) find_program(SELF_PACKER_FOR_EXECUTABLE upx ${CYGWIN_INSTALL_PATH}/bin - /bin - /usr/bin - /usr/local/bin - /sbin ) find_program(SELF_PACKER_FOR_SHARED_LIB upx ${CYGWIN_INSTALL_PATH}/bin - /bin - /usr/bin - /usr/local/bin - /sbin ) mark_as_advanced( diff --git a/Modules/FindSquish.cmake b/Modules/FindSquish.cmake index 09bdf1f..d1ce200 100644 --- a/Modules/FindSquish.cmake +++ b/Modules/FindSquish.cmake @@ -144,9 +144,6 @@ if(NOT SQUISH_INSTALL_DIR) # Look in places relative to the system executable search path. ${SQUISH_INSTALL_DIR_SEARCH} - # Look in standard UNIX install locations. - #/usr/local/squish - DOC "The ${SQUISH_INSTALL_DIR_STRING}" ) endif() diff --git a/Modules/FindTCL.cmake b/Modules/FindTCL.cmake index a711493..80779b3 100644 --- a/Modules/FindTCL.cmake +++ b/Modules/FindTCL.cmake @@ -82,11 +82,16 @@ set(TCLTK_POSSIBLE_LIB_PATHS "${TK_LIBRARY_PATH}" "${TCL_TCLSH_PATH_PARENT}/lib" "${TK_WISH_PATH_PARENT}/lib" - /usr/local/lib/tcl/tcl8.5 - /usr/local/lib/tcl/tk8.5 - /usr/local/lib/tcl/tcl8.4 - /usr/local/lib/tcl/tk8.4 - ) +) + +set(TCLTK_POSSIBLE_LIB_PATH_SUFFIXES + lib/tcl/tcl8.6 + lib/tcl/tk8.6 + lib/tcl/tcl8.5 + lib/tcl/tk8.5 + lib/tcl/tcl8.4 + lib/tcl/tk8.4 +) if(WIN32) get_filename_component( @@ -118,6 +123,7 @@ find_library(TCL_LIBRARY tcl82 tcl8.2 tcl80 tcl8.0 PATHS ${TCLTK_POSSIBLE_LIB_PATHS} + PATH_SUFFIXES ${TCLTK_POSSIBLE_LIB_PATH_SUFFIXES} ) find_library(TK_LIBRARY @@ -131,6 +137,7 @@ find_library(TK_LIBRARY tk82 tk8.2 tk80 tk8.0 PATHS ${TCLTK_POSSIBLE_LIB_PATHS} + PATH_SUFFIXES ${TCLTK_POSSIBLE_LIB_PATH_SUFFIXES} ) CMAKE_FIND_FRAMEWORKS(Tcl) @@ -164,20 +171,20 @@ set(TCLTK_POSSIBLE_INCLUDE_PATHS ${TK_FRAMEWORK_INCLUDES} "${TCL_TCLSH_PATH_PARENT}/include" "${TK_WISH_PATH_PARENT}/include" - /usr/include/tcl${TK_LIBRARY_VERSION} - /usr/include/tcl${TCL_LIBRARY_VERSION} - /usr/include/tcl8.6 - /usr/include/tcl8.5 - /usr/include/tcl8.4 - /usr/include/tcl8.3 - /usr/include/tcl8.2 - /usr/include/tcl8.0 - /usr/local/include/tcl8.6 - /usr/local/include/tk8.6 - /usr/local/include/tcl8.5 - /usr/local/include/tk8.5 - /usr/local/include/tcl8.4 - /usr/local/include/tk8.4 + ) + +set(TCLTK_POSSIBLE_INCLUDE_PATH_SUFFIXES + include/tcl${TK_LIBRARY_VERSION} + include/tcl${TCL_LIBRARY_VERSION} + include/tcl8.6 + include/tk8.6 + include/tcl8.5 + include/tk8.5 + include/tcl8.4 + include/tk8.4 + include/tcl8.3 + include/tcl8.2 + include/tcl8.0 ) if(WIN32) @@ -198,11 +205,13 @@ endif() find_path(TCL_INCLUDE_PATH NAMES tcl.h HINTS ${TCLTK_POSSIBLE_INCLUDE_PATHS} + PATH_SUFFIXES ${TCLTK_POSSIBLE_INCLUDE_PATH_SUFFIXES} ) find_path(TK_INCLUDE_PATH NAMES tk.h HINTS ${TCLTK_POSSIBLE_INCLUDE_PATHS} + PATH_SUFFIXES ${TCLTK_POSSIBLE_INCLUDE_PATH_SUFFIXES} ) include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) diff --git a/Modules/FindUnixCommands.cmake b/Modules/FindUnixCommands.cmake index d2b6a4d..45047a9 100644 --- a/Modules/FindUnixCommands.cmake +++ b/Modules/FindUnixCommands.cmake @@ -15,10 +15,6 @@ include(${CMAKE_CURRENT_LIST_DIR}/FindCygwin.cmake) find_program(BASH bash ${CYGWIN_INSTALL_PATH}/bin - /bin - /usr/bin - /usr/local/bin - /sbin ) mark_as_advanced( BASH @@ -27,10 +23,6 @@ mark_as_advanced( find_program(CP cp ${CYGWIN_INSTALL_PATH}/bin - /bin - /usr/bin - /usr/local/bin - /sbin ) mark_as_advanced( CP @@ -39,10 +31,6 @@ mark_as_advanced( find_program(GZIP gzip ${CYGWIN_INSTALL_PATH}/bin - /bin - /usr/bin - /usr/local/bin - /sbin ) mark_as_advanced( GZIP @@ -51,10 +39,6 @@ mark_as_advanced( find_program(MV mv ${CYGWIN_INSTALL_PATH}/bin - /bin - /usr/bin - /usr/local/bin - /sbin ) mark_as_advanced( MV @@ -63,10 +47,6 @@ mark_as_advanced( find_program(RM rm ${CYGWIN_INSTALL_PATH}/bin - /bin - /usr/bin - /usr/local/bin - /sbin ) mark_as_advanced( RM @@ -78,10 +58,6 @@ find_program(TAR gtar PATH ${CYGWIN_INSTALL_PATH}/bin - /bin - /usr/bin - /usr/local/bin - /sbin ) mark_as_advanced( TAR diff --git a/Modules/Findosg_functions.cmake b/Modules/Findosg_functions.cmake index c81c448..83d9844 100644 --- a/Modules/Findosg_functions.cmake +++ b/Modules/Findosg_functions.cmake @@ -28,13 +28,6 @@ function(OSG_FIND_PATH module header) ENV OSG_ROOT ${${module_uc}_DIR} ${OSG_DIR} - PATH_SUFFIXES include - PATHS - /sw # Fink - /opt/local # DarwinPorts - /opt/csw # Blastwave - /opt - /usr/freeware ) endfunction() @@ -54,13 +47,6 @@ function(OSG_FIND_LIBRARY module library) ENV OSG_ROOT ${${module_uc}_DIR} ${OSG_DIR} - PATH_SUFFIXES lib - PATHS - /sw # Fink - /opt/local # DarwinPorts - /opt/csw # Blastwave - /opt - /usr/freeware ) find_library(${module_uc}_LIBRARY_DEBUG @@ -72,13 +58,6 @@ function(OSG_FIND_LIBRARY module library) ENV OSG_ROOT ${${module_uc}_DIR} ${OSG_DIR} - PATH_SUFFIXES lib - PATHS - /sw # Fink - /opt/local # DarwinPorts - /opt/csw # Blastwave - /opt - /usr/freeware ) if(NOT ${module_uc}_LIBRARY_DEBUG) diff --git a/Modules/GNUInstallDirs.cmake b/Modules/GNUInstallDirs.cmake index 91361d2..9dd464c 100644 --- a/Modules/GNUInstallDirs.cmake +++ b/Modules/GNUInstallDirs.cmake @@ -205,7 +205,7 @@ if(NOT DEFINED CMAKE_INSTALL_LIBDIR OR (_libdir_set # - we are on Linux system but NOT cross-compiling # - we are NOT on debian # - we are on a 64 bits system - # reason is: amd64 ABI: http://www.x86-64.org/documentation/abi.pdf + # reason is: amd64 ABI: https://github.com/hjl-tools/x86-psABI/wiki/X86-psABI # For Debian with multiarch, use 'lib/${CMAKE_LIBRARY_ARCHITECTURE}' if # CMAKE_LIBRARY_ARCHITECTURE is set (which contains e.g. "i386-linux-gnu" # and CMAKE_INSTALL_PREFIX is "/usr" diff --git a/Modules/GetPrerequisites.cmake b/Modules/GetPrerequisites.cmake index b81dd76..d397791 100644 --- a/Modules/GetPrerequisites.cmake +++ b/Modules/GetPrerequisites.cmake @@ -687,8 +687,6 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa "$ENV{VS71COMNTOOLS}/../../VC7/bin" "C:/Program Files/Microsoft Visual Studio .NET 2003/VC7/BIN" "C:/Program Files (x86)/Microsoft Visual Studio .NET 2003/VC7/BIN" - "/usr/local/bin" - "/usr/bin" ) # <setup-gp_tool-vars> diff --git a/Modules/Platform/UnixPaths.cmake b/Modules/Platform/UnixPaths.cmake index 5687653..328d3c6 100644 --- a/Modules/Platform/UnixPaths.cmake +++ b/Modules/Platform/UnixPaths.cmake @@ -69,6 +69,9 @@ list(APPEND CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES list(APPEND CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES /usr/include ) +list(APPEND CMAKE_CUDA_IMPLICIT_INCLUDE_DIRECTORIES + /usr/include + ) # Enable use of lib32 and lib64 search path variants by default. set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB32_PATHS TRUE) diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 6c60675..33ab093 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -921,7 +921,7 @@ if(UNIX) # OpenBSD and also Linux and OSX. Look for the header and # the library; it's a warning on FreeBSD if they're not # found, and informational on other platforms. - find_path(FREEBSD_PKG_INCLUDE_DIRS "pkg.h" PATHS /usr/local) + find_path(FREEBSD_PKG_INCLUDE_DIRS "pkg.h") if(FREEBSD_PKG_INCLUDE_DIRS) find_library(FREEBSD_PKG_LIBRARIES pkg diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 01b42b1..eca7be2 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 10) -set(CMake_VERSION_PATCH 20171122) +set(CMake_VERSION_PATCH 20171129) #set(CMake_VERSION_RC 1) diff --git a/Source/cmAddCustomTargetCommand.cxx b/Source/cmAddCustomTargetCommand.cxx index f4b4f66..819c781 100644 --- a/Source/cmAddCustomTargetCommand.cxx +++ b/Source/cmAddCustomTargetCommand.cxx @@ -209,9 +209,9 @@ bool cmAddCustomTargetCommand::InitialPass( // Add the utility target to the makefile. bool escapeOldStyle = !verbatim; cmTarget* target = this->Makefile->AddUtilityCommand( - targetName, excludeFromAll, working_directory.c_str(), byproducts, depends, - commandLines, escapeOldStyle, comment, uses_terminal, - command_expand_lists); + targetName, cmMakefile::TargetOrigin::Project, excludeFromAll, + working_directory.c_str(), byproducts, depends, commandLines, + escapeOldStyle, comment, uses_terminal, command_expand_lists); // Add additional user-specified source files to the target. target->AddSources(sources); diff --git a/Source/cmCPluginAPI.cxx b/Source/cmCPluginAPI.cxx index e1e11af..18a1022 100644 --- a/Source/cmCPluginAPI.cxx +++ b/Source/cmCPluginAPI.cxx @@ -218,8 +218,8 @@ void CCONV cmAddUtilityCommand(void* arg, const char* utilityName, } // Pass the call to the makefile instance. - mf->AddUtilityCommand(utilityName, (all ? false : true), nullptr, depends2, - commandLines); + mf->AddUtilityCommand(utilityName, cmMakefile::TargetOrigin::Project, + (all ? false : true), nullptr, depends2, commandLines); } void CCONV cmAddCustomCommand(void* arg, const char* source, const char* command, int numArgs, diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx index 7fe0cbe..3d311d6 100644 --- a/Source/cmGeneratorExpressionNode.cxx +++ b/Source/cmGeneratorExpressionNode.cxx @@ -828,18 +828,21 @@ static const struct CompileLanguageNode : public cmGeneratorExpressionNode } std::string genName = gg->GetName(); if (genName.find("Visual Studio") != std::string::npos) { - reportError(context, content->GetOriginalExpression(), - "$<COMPILE_LANGUAGE:...> may not be used with Visual Studio " - "generators."); - return std::string(); - } - if (genName.find("Xcode") != std::string::npos) { if (dagChecker && (dagChecker->EvaluatingCompileDefinitions() || dagChecker->EvaluatingIncludeDirectories())) { reportError( context, content->GetOriginalExpression(), - "$<COMPILE_LANGUAGE:...> may only be used with COMPILE_OPTIONS " - "with the Xcode generator."); + "$<COMPILE_LANGUAGE:...> may only be used for COMPILE_OPTIONS " + "and file(GENERATE) with the Visual Studio generator."); + return std::string(); + } + } else if (genName.find("Xcode") != std::string::npos) { + if (dagChecker && (dagChecker->EvaluatingCompileDefinitions() || + dagChecker->EvaluatingIncludeDirectories())) { + reportError( + context, content->GetOriginalExpression(), + "$<COMPILE_LANGUAGE:...> may only be used for COMPILE_OPTIONS " + "and file(GENERATE) with the Xcode generator."); return std::string(); } } else { diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx index dee874f..1743b18 100644 --- a/Source/cmGlobalVisualStudio8Generator.cxx +++ b/Source/cmGlobalVisualStudio8Generator.cxx @@ -225,9 +225,9 @@ bool cmGlobalVisualStudio8Generator::AddCheckTarget() } cmCustomCommandLines noCommandLines; - cmTarget* tgt = - mf->AddUtilityCommand(CMAKE_CHECK_BUILD_SYSTEM_TARGET, false, - no_working_directory, no_depends, noCommandLines); + cmTarget* tgt = mf->AddUtilityCommand( + CMAKE_CHECK_BUILD_SYSTEM_TARGET, cmMakefile::TargetOrigin::Generator, + false, no_working_directory, no_depends, noCommandLines); cmGeneratorTarget* gt = new cmGeneratorTarget(tgt, lg); lg->AddGeneratorTarget(gt); diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx index 99600df..c89c2c4 100644 --- a/Source/cmGlobalVisualStudioGenerator.cxx +++ b/Source/cmGlobalVisualStudioGenerator.cxx @@ -69,8 +69,8 @@ void cmGlobalVisualStudioGenerator::AddExtraIDETargets() // Use no actual command lines so that the target itself is not // considered always out of date. cmTarget* allBuild = gen[0]->GetMakefile()->AddUtilityCommand( - "ALL_BUILD", true, no_working_dir, no_depends, no_commands, false, - "Build all projects"); + "ALL_BUILD", cmMakefile::TargetOrigin::Generator, true, no_working_dir, + no_depends, no_commands, false, "Build all projects"); cmGeneratorTarget* gt = new cmGeneratorTarget(allBuild, gen[0]); gen[0]->AddGeneratorTarget(gt); diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 41fe5d2..c376c8d 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -440,9 +440,9 @@ void cmGlobalXCodeGenerator::AddExtraTargets( // Add ALL_BUILD const char* no_working_directory = nullptr; std::vector<std::string> no_depends; - cmTarget* allbuild = - mf->AddUtilityCommand("ALL_BUILD", true, no_depends, no_working_directory, - "echo", "Build all projects"); + cmTarget* allbuild = mf->AddUtilityCommand( + "ALL_BUILD", cmMakefile::TargetOrigin::Generator, true, no_depends, + no_working_directory, "echo", "Build all projects"); cmGeneratorTarget* allBuildGt = new cmGeneratorTarget(allbuild, root); root->AddGeneratorTarget(allBuildGt); @@ -464,9 +464,9 @@ void cmGlobalXCodeGenerator::AddExtraTargets( std::string file = this->ConvertToRelativeForMake(this->CurrentReRunCMakeMakefile.c_str()); cmSystemTools::ReplaceString(file, "\\ ", " "); - cmTarget* check = - mf->AddUtilityCommand(CMAKE_CHECK_BUILD_SYSTEM_TARGET, true, no_depends, - no_working_directory, "make", "-f", file.c_str()); + cmTarget* check = mf->AddUtilityCommand( + CMAKE_CHECK_BUILD_SYSTEM_TARGET, cmMakefile::TargetOrigin::Generator, + true, no_depends, no_working_directory, "make", "-f", file.c_str()); cmGeneratorTarget* checkGt = new cmGeneratorTarget(check, root); root->AddGeneratorTarget(checkGt); diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 0855e79..a9de3f5 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1007,7 +1007,7 @@ void cmMakefile::AddCustomCommandOldStyle( } cmTarget* cmMakefile::AddUtilityCommand( - const std::string& utilityName, bool excludeFromAll, + const std::string& utilityName, TargetOrigin origin, bool excludeFromAll, const std::vector<std::string>& depends, const char* workingDirectory, const char* command, const char* arg1, const char* arg2, const char* arg3, const char* arg4) @@ -1031,25 +1031,25 @@ cmTarget* cmMakefile::AddUtilityCommand( commandLines.push_back(commandLine); // Call the real signature of this method. - return this->AddUtilityCommand(utilityName, excludeFromAll, workingDirectory, - depends, commandLines); + return this->AddUtilityCommand(utilityName, origin, excludeFromAll, + workingDirectory, depends, commandLines); } cmTarget* cmMakefile::AddUtilityCommand( - const std::string& utilityName, bool excludeFromAll, + const std::string& utilityName, TargetOrigin origin, bool excludeFromAll, const char* workingDirectory, const std::vector<std::string>& depends, const cmCustomCommandLines& commandLines, bool escapeOldStyle, const char* comment, bool uses_terminal, bool command_expand_lists) { std::vector<std::string> no_byproducts; - return this->AddUtilityCommand(utilityName, excludeFromAll, workingDirectory, - no_byproducts, depends, commandLines, - escapeOldStyle, comment, uses_terminal, - command_expand_lists); + return this->AddUtilityCommand(utilityName, origin, excludeFromAll, + workingDirectory, no_byproducts, depends, + commandLines, escapeOldStyle, comment, + uses_terminal, command_expand_lists); } cmTarget* cmMakefile::AddUtilityCommand( - const std::string& utilityName, bool excludeFromAll, + const std::string& utilityName, TargetOrigin origin, bool excludeFromAll, const char* workingDirectory, const std::vector<std::string>& byproducts, const std::vector<std::string>& depends, const cmCustomCommandLines& commandLines, bool escapeOldStyle, @@ -1057,6 +1057,7 @@ cmTarget* cmMakefile::AddUtilityCommand( { // Create a target instance for this utility. cmTarget* target = this->AddNewTarget(cmStateEnums::UTILITY, utilityName); + target->SetIsGeneratorProvided(origin == TargetOrigin::Generator); if (excludeFromAll) { target->SetProperty("EXCLUDE_FROM_ALL", "TRUE"); } @@ -3335,13 +3336,6 @@ cmGlobalGenerator* cmMakefile::GetGlobalGenerator() const return this->GlobalGenerator; } -void cmMakefile::GetTestNames(std::vector<std::string>& testNames) -{ - for (const auto& iter : Tests) { - testNames.push_back(iter.first); - } -} - #ifdef CMAKE_BUILD_WITH_CMAKE cmVariableWatch* cmMakefile::GetVariableWatch() const { @@ -3677,6 +3671,16 @@ cmTest* cmMakefile::GetTest(const std::string& testName) const return nullptr; } +void cmMakefile::GetTests(const std::string& config, + std::vector<cmTest*>& tests) +{ + for (auto generator : this->GetTestGenerators()) { + if (generator->TestsForConfig(config)) { + tests.push_back(generator->GetTest()); + } + } +} + void cmMakefile::AddCMakeDependFilesFromUser() { std::vector<std::string> deps; diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 7c27aef..737cab9 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -183,12 +183,19 @@ public: const std::vector<std::string>& srcs, bool excludeFromAll = false); + /** Where the target originated from. */ + enum class TargetOrigin + { + Project, + Generator + }; + /** * Add a utility to the build. A utiltity target is a command that * is run every time the target is built. */ cmTarget* AddUtilityCommand(const std::string& utilityName, - bool excludeFromAll, + TargetOrigin origin, bool excludeFromAll, const std::vector<std::string>& depends, const char* workingDirectory, const char* command, const char* arg1 = nullptr, @@ -196,13 +203,13 @@ public: const char* arg3 = nullptr, const char* arg4 = nullptr); cmTarget* AddUtilityCommand( - const std::string& utilityName, bool excludeFromAll, + const std::string& utilityName, TargetOrigin origin, bool excludeFromAll, const char* workingDirectory, const std::vector<std::string>& depends, const cmCustomCommandLines& commandLines, bool escapeOldStyle = true, const char* comment = nullptr, bool uses_terminal = false, bool command_expand_lists = false); cmTarget* AddUtilityCommand( - const std::string& utilityName, bool excludeFromAll, + const std::string& utilityName, TargetOrigin origin, bool excludeFromAll, const char* workingDirectory, const std::vector<std::string>& byproducts, const std::vector<std::string>& depends, const cmCustomCommandLines& commandLines, bool escapeOldStyle = true, @@ -617,11 +624,6 @@ public: cmGlobalGenerator* GetGlobalGenerator() const; /** - * Get all the test names this makefile knows about - */ - void GetTestNames(std::vector<std::string>& testNames); - - /** * Get all the source files this makefile knows about */ const std::vector<cmSourceFile*>& GetSourceFiles() const @@ -644,6 +646,11 @@ public: cmTest* GetTest(const std::string& testName) const; /** + * Get all tests that run under the given configuration. + */ + void GetTests(const std::string& config, std::vector<cmTest*>& tests); + + /** * Return a location of a file in cmake or custom modules directory */ std::string GetModulesFile(const char* name) const; diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 7db010c..dd8a373 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -657,8 +657,8 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile( } // Maybe insert a compiler launcher like ccache or distcc - if (!compileCommands.empty() && - (lang == "C" || lang == "CXX" || lang == "CUDA")) { + if (!compileCommands.empty() && (lang == "C" || lang == "CXX" || + lang == "Fortran" || lang == "CUDA")) { std::string const clauncher_prop = lang + "_COMPILER_LAUNCHER"; const char* clauncher = this->GeneratorTarget->GetProperty(clauncher_prop); diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 5805259..0262b3c 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -647,7 +647,7 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang) // Maybe insert a compiler launcher like ccache or distcc if (!compileCmds.empty() && - (lang == "C" || lang == "CXX" || lang == "CUDA")) { + (lang == "C" || lang == "CXX" || lang == "Fortran" || lang == "CUDA")) { std::string const clauncher_prop = lang + "_COMPILER_LAUNCHER"; const char* clauncher = this->GeneratorTarget->GetProperty(clauncher_prop); if (clauncher && *clauncher) { diff --git a/Source/cmQtAutoGeneratorInitializer.cxx b/Source/cmQtAutoGeneratorInitializer.cxx index d9a5a9a..bd692a2 100644 --- a/Source/cmQtAutoGeneratorInitializer.cxx +++ b/Source/cmQtAutoGeneratorInitializer.cxx @@ -684,8 +684,9 @@ void cmQtAutoGeneratorInitializer::InitCustomTargets() ccDepends.push_back(qrc.QrcFile); cmTarget* autoRccTarget = makefile->AddUtilityCommand( - ccName, true, this->DirWork.c_str(), ccOutput, ccDepends, - commandLines, false, ccComment.c_str()); + ccName, cmMakefile::TargetOrigin::Generator, true, + this->DirWork.c_str(), ccOutput, ccDepends, commandLines, false, + ccComment.c_str()); // Create autogen generator target localGen->AddGeneratorTarget( new cmGeneratorTarget(autoRccTarget, localGen)); @@ -852,9 +853,9 @@ void cmQtAutoGeneratorInitializer::InitCustomTargets() // Create autogen target cmTarget* autogenTarget = makefile->AddUtilityCommand( - this->AutogenTargetName, true, this->DirWork.c_str(), - /*byproducts=*/autogenProvides, autogenDepends, commandLines, false, - autogenComment.c_str()); + this->AutogenTargetName, cmMakefile::TargetOrigin::Generator, true, + this->DirWork.c_str(), /*byproducts=*/autogenProvides, autogenDepends, + commandLines, false, autogenComment.c_str()); // Create autogen generator target localGen->AddGeneratorTarget( new cmGeneratorTarget(autogenTarget, localGen)); diff --git a/Source/cmServerDictionary.h b/Source/cmServerDictionary.h index 8cd5e14..62dee11 100644 --- a/Source/cmServerDictionary.h +++ b/Source/cmServerDictionary.h @@ -91,11 +91,11 @@ static const std::string kWATCHED_DIRECTORIES_KEY = "watchedDirectories"; static const std::string kWATCHED_FILES_KEY = "watchedFiles"; static const std::string kHAS_INSTALL_RULE = "hasInstallRule"; static const std::string kINSTALL_PATHS = "installPaths"; -static const std::string kHAS_ENABLED_TESTS = "hasEnabledTests"; static const std::string kCTEST_NAME = "ctestName"; static const std::string kCTEST_COMMAND = "ctestCommand"; static const std::string kCTEST_INFO = "ctestInfo"; static const std::string kMINIMUM_CMAKE_VERSION = "minimumCMakeVersion"; +static const std::string kIS_GENERATOR_PROVIDED_KEY = "isGeneratorProvided"; static const std::string kTARGET_CROSS_REFERENCES_KEY = "crossReferences"; static const std::string kLINE_NUMBER_KEY = "line"; diff --git a/Source/cmServerProtocol.cxx b/Source/cmServerProtocol.cxx index aae0a9d..cfac513 100644 --- a/Source/cmServerProtocol.cxx +++ b/Source/cmServerProtocol.cxx @@ -771,10 +771,10 @@ static void DumpBacktraceRange(Json::Value& result, const std::string& type, } } -static Json::Value DumpCTestInfo(const std::string& name, cmTest* testInfo) +static Json::Value DumpCTestInfo(cmTest* testInfo) { Json::Value result = Json::objectValue; - result[kCTEST_NAME] = name; + result[kCTEST_NAME] = testInfo->GetName(); // Concat command entries together. After the first should be the arguments // for the command @@ -801,76 +801,17 @@ static Json::Value DumpCTestInfo(const std::string& name, cmTest* testInfo) return result; } -static Json::Value DumpCTestTarget(cmGeneratorTarget* target, - const std::string& config) +static void DumpMakefileTests(cmMakefile* mf, const std::string& config, + Json::Value* result) { - cmLocalGenerator* lg = target->GetLocalGenerator(); - const cmState* state = lg->GetState(); - - const cmStateEnums::TargetType type = target->GetType(); - const std::string typeName = state->GetTargetTypeName(type); - - Json::Value ttl = Json::arrayValue; - ttl.append("EXECUTABLE"); - ttl.append("STATIC_LIBRARY"); - ttl.append("SHARED_LIBRARY"); - ttl.append("MODULE_LIBRARY"); - ttl.append("OBJECT_LIBRARY"); - ttl.append("UTILITY"); - ttl.append("INTERFACE_LIBRARY"); - - if (!hasString(ttl, typeName) || target->IsImported()) { - return Json::Value(); - } - - Json::Value result = Json::objectValue; - result[kNAME_KEY] = target->GetName(); - result[kTYPE_KEY] = typeName; - - if (type == cmStateEnums::INTERFACE_LIBRARY) { - return result; - } - result[kFULL_NAME_KEY] = target->GetFullName(config); - - if (target->Makefile->IsOn("CMAKE_TESTING_ENABLED")) { - result[kHAS_ENABLED_TESTS] = true; - std::vector<std::string> CTestNames; - - Json::Value testInfo = Json::arrayValue; - std::vector<std::string> testNames; - target->Makefile->GetTestNames(testNames); - for (auto& name : testNames) { - auto test = target->Makefile->GetTest(name); - if (test != nullptr) { - testInfo.append(DumpCTestInfo(name, test)); - } - } - result[kCTEST_INFO] = testInfo; - } - - return result; -} - -static Json::Value DumpCTestTargetsList( - const std::vector<cmLocalGenerator*>& generators, const std::string& config) -{ - Json::Value result = Json::arrayValue; - - std::vector<cmGeneratorTarget*> targetList; - for (const auto& lgIt : generators) { - auto list = lgIt->GetGeneratorTargets(); - targetList.insert(targetList.end(), list.begin(), list.end()); - } - std::sort(targetList.begin(), targetList.end()); - - for (cmGeneratorTarget* target : targetList) { - Json::Value tmp = DumpCTestTarget(target, config); + std::vector<cmTest*> tests; + mf->GetTests(config, tests); + for (auto test : tests) { + Json::Value tmp = DumpCTestInfo(test); if (!tmp.isNull()) { - result.append(tmp); + result->append(tmp); } } - - return result; } static Json::Value DumpCTestProjectList(const cmake* cm, @@ -884,11 +825,17 @@ static Json::Value DumpCTestProjectList(const cmake* cm, Json::Value pObj = Json::objectValue; pObj[kNAME_KEY] = projectIt.first; - // All Projects must have at least one local generator - assert(!projectIt.second.empty()); + Json::Value tests = Json::arrayValue; - // Project structure information: - pObj[kTARGETS_KEY] = DumpCTestTargetsList(projectIt.second, config); + // Gather tests for every generator + for (const auto& lg : projectIt.second) { + // Make sure they're generated. + lg->GenerateTestFiles(); + cmMakefile* mf = lg->GetMakefile(); + DumpMakefileTests(mf, config, &tests); + } + + pObj[kCTEST_INFO] = tests; result.append(pObj); } @@ -942,6 +889,8 @@ static Json::Value DumpTarget(cmGeneratorTarget* target, Json::Value result = Json::objectValue; result[kNAME_KEY] = target->GetName(); + result[kIS_GENERATOR_PROVIDED_KEY] = + target->Target->GetIsGeneratorProvided(); result[kTYPE_KEY] = typeName; result[kSOURCE_DIRECTORY_KEY] = lg->GetCurrentSourceDirectory(); result[kBUILD_DIRECTORY_KEY] = lg->GetCurrentBinaryDirectory(); diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index bf36074..de23b08 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -176,6 +176,7 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type, Visibility vis, cmMakefile* mf) { assert(mf); + this->IsGeneratorProvided = false; this->Name = name; this->TargetTypeValue = type; this->Makefile = mf; @@ -238,6 +239,7 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type, this->SetPropertyDefault("COMPILE_PDB_OUTPUT_DIRECTORY", nullptr); this->SetPropertyDefault("Fortran_FORMAT", nullptr); this->SetPropertyDefault("Fortran_MODULE_DIRECTORY", nullptr); + this->SetPropertyDefault("Fortran_COMPILER_LAUNCHER", nullptr); this->SetPropertyDefault("GNUtoMS", nullptr); this->SetPropertyDefault("OSX_ARCHITECTURES", nullptr); this->SetPropertyDefault("IOS_INSTALL_COMBINED", nullptr); diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 940e26c..56f3e3a 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -180,6 +180,12 @@ public: bool GetHaveInstallRule() const { return this->HaveInstallRule; } void SetHaveInstallRule(bool h) { this->HaveInstallRule = h; } + /** + * Get/Set whether this target was auto-created by a generator. + */ + bool GetIsGeneratorProvided() const { return this->IsGeneratorProvided; } + void SetIsGeneratorProvided(bool igp) { this->IsGeneratorProvided = igp; } + /** Add a utility on which this project depends. A utility is an executable * name as would be specified to the ADD_EXECUTABLE or UTILITY_SOURCE * commands. It is not a full path nor does it have an extension. @@ -284,6 +290,7 @@ private: std::string const& value) const; private: + bool IsGeneratorProvided; cmPropertyMap Properties; std::set<std::string> SystemIncludeDirectories; std::set<std::string> LinkDirectoriesEmmitted; diff --git a/Source/cmTestGenerator.cxx b/Source/cmTestGenerator.cxx index 78ca6bc..b548359 100644 --- a/Source/cmTestGenerator.cxx +++ b/Source/cmTestGenerator.cxx @@ -34,6 +34,16 @@ void cmTestGenerator::Compute(cmLocalGenerator* lg) this->LG = lg; } +bool cmTestGenerator::TestsForConfig(const std::string& config) +{ + return this->GeneratesForConfig(config); +} + +cmTest* cmTestGenerator::GetTest() const +{ + return this->Test; +} + void cmTestGenerator::GenerateScriptConfigs(std::ostream& os, Indent indent) { // Create the tests. diff --git a/Source/cmTestGenerator.h b/Source/cmTestGenerator.h index 1ca61c2..73d05a3 100644 --- a/Source/cmTestGenerator.h +++ b/Source/cmTestGenerator.h @@ -30,6 +30,11 @@ public: void Compute(cmLocalGenerator* lg); + /** Test if this generator installs the test for a given configuration. */ + bool TestsForConfig(const std::string& config); + + cmTest* GetTest() const; + protected: void GenerateScriptConfigs(std::ostream& os, Indent indent) override; void GenerateScriptActions(std::ostream& os, Indent indent) override; diff --git a/Tests/CMakeCommands/target_compile_options/CMakeLists.txt b/Tests/CMakeCommands/target_compile_options/CMakeLists.txt index 35dd276..1dedbae 100644 --- a/Tests/CMakeCommands/target_compile_options/CMakeLists.txt +++ b/Tests/CMakeCommands/target_compile_options/CMakeLists.txt @@ -23,18 +23,19 @@ add_executable(consumer "${CMAKE_CURRENT_SOURCE_DIR}/consumer.cpp" ) -if (NOT CMAKE_GENERATOR MATCHES "Visual Studio") - target_sources(consumer PRIVATE - "${CMAKE_CURRENT_SOURCE_DIR}/consumer.c" - ) - target_compile_options(consumer - PRIVATE - -DCONSUMER_LANG_$<COMPILE_LANGUAGE> - -DLANG_IS_CXX=$<COMPILE_LANGUAGE:CXX> - -DLANG_IS_C=$<COMPILE_LANGUAGE:C> - ) +target_sources(consumer PRIVATE + "${CMAKE_CURRENT_SOURCE_DIR}/consumer.c" +) +target_compile_options(consumer + PRIVATE + -DCONSUMER_LANG_$<COMPILE_LANGUAGE> + -DLANG_IS_CXX=$<COMPILE_LANGUAGE:CXX> + -DLANG_IS_C=$<COMPILE_LANGUAGE:C> +) + +if(CMAKE_GENERATOR MATCHES "Visual Studio") target_compile_definitions(consumer - PRIVATE -DTEST_LANG_DEFINES + PRIVATE TEST_LANG_DEFINES_FOR_VISUAL_STUDIO ) endif() diff --git a/Tests/CMakeCommands/target_compile_options/consumer.c b/Tests/CMakeCommands/target_compile_options/consumer.c index 7931a6f..420b4cc 100644 --- a/Tests/CMakeCommands/target_compile_options/consumer.c +++ b/Tests/CMakeCommands/target_compile_options/consumer.c @@ -1,5 +1,23 @@ -#ifdef TEST_LANG_DEFINES +// Visual Studio allows only one set of flags for C and C++. +// In a target using C++ we pick the C++ flags even for C sources. +#ifdef TEST_LANG_DEFINES_FOR_VISUAL_STUDIO +#ifndef CONSUMER_LANG_CXX +#error Expected CONSUMER_LANG_CXX +#endif + +#ifdef CONSUMER_LANG_C +#error Unexpected CONSUMER_LANG_C +#endif + +#if !LANG_IS_CXX +#error Expected LANG_IS_CXX +#endif + +#if LANG_IS_C +#error Unexpected LANG_IS_C +#endif +#else #ifdef CONSUMER_LANG_CXX #error Unexpected CONSUMER_LANG_CXX #endif diff --git a/Tests/CMakeCommands/target_compile_options/consumer.cpp b/Tests/CMakeCommands/target_compile_options/consumer.cpp index 71a6098..7750950 100644 --- a/Tests/CMakeCommands/target_compile_options/consumer.cpp +++ b/Tests/CMakeCommands/target_compile_options/consumer.cpp @@ -15,7 +15,6 @@ #endif -#ifdef TEST_LANG_DEFINES #ifndef CONSUMER_LANG_CXX #error Expected CONSUMER_LANG_CXX #endif @@ -31,7 +30,6 @@ #if LANG_IS_C #error Unexpected LANG_IS_C #endif -#endif int main() { diff --git a/Tests/CudaOnly/WithDefs/CMakeLists.txt b/Tests/CudaOnly/WithDefs/CMakeLists.txt index 9b82366..5bd93a4 100644 --- a/Tests/CudaOnly/WithDefs/CMakeLists.txt +++ b/Tests/CudaOnly/WithDefs/CMakeLists.txt @@ -32,6 +32,8 @@ add_executable(CudaOnlyWithDefs ${main}) target_compile_options(CudaOnlyWithDefs PRIVATE + -DCOMPILE_LANG_$<COMPILE_LANGUAGE> + -DLANG_IS_CUDA=$<COMPILE_LANGUAGE:CUDA> -Xcompiler=-DHOST_DEFINE $<$<CONFIG:DEBUG>:$<BUILD_INTERFACE:${debug_compile_flags}>> ) diff --git a/Tests/CudaOnly/WithDefs/main.notcu b/Tests/CudaOnly/WithDefs/main.notcu index d2eff3f..bfb3577 100644 --- a/Tests/CudaOnly/WithDefs/main.notcu +++ b/Tests/CudaOnly/WithDefs/main.notcu @@ -10,6 +10,18 @@ #error "PACKED_DEFINE not defined!" #endif +#ifndef COMPILE_LANG_CUDA +#error "COMPILE_LANG_CUDA not defined!" +#endif + +#ifndef LANG_IS_CUDA +#error "LANG_IS_CUDA not defined!" +#endif + +#if !LANG_IS_CUDA +#error "Expected LANG_IS_CUDA" +#endif + static __global__ void DetermineIfValidCudaDevice() { } diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index f306200..aa075b0 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -385,6 +385,9 @@ if("${CMAKE_GENERATOR}" MATCHES "Make|Ninja") if(DEFINED CMake_TEST_CUDA) list(APPEND CompilerLauncher_ARGS -DCMake_TEST_CUDA=${CMake_TEST_CUDA}) endif() + if(CMAKE_Fortran_COMPILER) + list(APPEND CompilerLauncher_ARGS -DCMake_TEST_Fortran=1) + endif() add_RunCMake_test(CompilerLauncher) add_RunCMake_test(ctest_labels_for_subprojects) endif() diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileDefinitions-stderr-VS.txt b/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileDefinitions-stderr-VS.txt index 73b66ac..42c1485 100644 --- a/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileDefinitions-stderr-VS.txt +++ b/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileDefinitions-stderr-VS.txt @@ -3,6 +3,7 @@ CMake Error at CompileDefinitions.cmake:5 \(target_compile_definitions\): \$<COMPILE_LANGUAGE:CXX> - \$<COMPILE_LANGUAGE:...> may not be used with Visual Studio generators. + \$<COMPILE_LANGUAGE:...> may only be used for COMPILE_OPTIONS and + file\(GENERATE\) with the Visual Studio generator. Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileDefinitions-stderr-Xcode.txt b/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileDefinitions-stderr-Xcode.txt index a1ed633..7879a79 100644 --- a/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileDefinitions-stderr-Xcode.txt +++ b/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileDefinitions-stderr-Xcode.txt @@ -3,7 +3,7 @@ CMake Error at CompileDefinitions.cmake:5 \(target_compile_definitions\): \$<COMPILE_LANGUAGE:CXX> - \$<COMPILE_LANGUAGE:...> may only be used with COMPILE_OPTIONS with the - Xcode generator. + \$<COMPILE_LANGUAGE:...> may only be used for COMPILE_OPTIONS and + file\(GENERATE\) with the Xcode generator. Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileOptions-result.txt b/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileOptions-result.txt deleted file mode 100644 index d00491f..0000000 --- a/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileOptions-result.txt +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileOptions-stderr-VS.txt b/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileOptions-stderr-VS.txt deleted file mode 100644 index e9e8e9f..0000000 --- a/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileOptions-stderr-VS.txt +++ /dev/null @@ -1,8 +0,0 @@ -CMake Error at CompileOptions.cmake:5 \(target_compile_options\): - Error evaluating generator expression: - - \$<COMPILE_LANGUAGE:CXX> - - \$<COMPILE_LANGUAGE:...> may not be used with Visual Studio generators. -Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileOptions.cmake b/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileOptions.cmake deleted file mode 100644 index 6c92abc..0000000 --- a/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileOptions.cmake +++ /dev/null @@ -1,5 +0,0 @@ - -enable_language(CXX) - -add_executable(main main.cpp) -target_compile_options(main PRIVATE $<$<COMPILE_LANGUAGE:CXX>:-DANYTHING>) diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories-stderr-VS.txt b/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories-stderr-VS.txt index ec15068..3806ed1 100644 --- a/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories-stderr-VS.txt +++ b/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories-stderr-VS.txt @@ -3,6 +3,7 @@ CMake Error at IncludeDirectories.cmake:5 \(target_include_directories\): \$<COMPILE_LANGUAGE:CXX> - \$<COMPILE_LANGUAGE:...> may not be used with Visual Studio generators. + \$<COMPILE_LANGUAGE:...> may only be used for COMPILE_OPTIONS and + file\(GENERATE\) with the Visual Studio generator. Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories-stderr-Xcode.txt b/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories-stderr-Xcode.txt index fdf92b2..a3fb9c5 100644 --- a/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories-stderr-Xcode.txt +++ b/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories-stderr-Xcode.txt @@ -3,7 +3,7 @@ CMake Error at IncludeDirectories.cmake:5 \(target_include_directories\): \$<COMPILE_LANGUAGE:CXX> - \$<COMPILE_LANGUAGE:...> may only be used with COMPILE_OPTIONS with the - Xcode generator. + \$<COMPILE_LANGUAGE:...> may only be used for COMPILE_OPTIONS and + file\(GENERATE\) with the Xcode generator. Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/RunCMakeTest.cmake b/Tests/RunCMake/COMPILE_LANGUAGE-genex/RunCMakeTest.cmake index 5e0a5f5..421fa73 100644 --- a/Tests/RunCMake/COMPILE_LANGUAGE-genex/RunCMakeTest.cmake +++ b/Tests/RunCMake/COMPILE_LANGUAGE-genex/RunCMakeTest.cmake @@ -1,9 +1,5 @@ include(RunCMake) -if (RunCMake_GENERATOR MATCHES "Visual Studio") - set(RunCMake-stderr-file CompileOptions-stderr-VS.txt) - run_cmake(CompileOptions) -endif() if (RunCMake_GENERATOR STREQUAL "Xcode") set(RunCMake-stderr-file CompileDefinitions-stderr-Xcode.txt) run_cmake(CompileDefinitions) diff --git a/Tests/RunCMake/CompilerLauncher/Fortran-Build-stdout.txt b/Tests/RunCMake/CompilerLauncher/Fortran-Build-stdout.txt new file mode 100644 index 0000000..3313e31 --- /dev/null +++ b/Tests/RunCMake/CompilerLauncher/Fortran-Build-stdout.txt @@ -0,0 +1 @@ +.*-E env USED_LAUNCHER=1.* diff --git a/Tests/RunCMake/CompilerLauncher/Fortran-launch-Build-stdout.txt b/Tests/RunCMake/CompilerLauncher/Fortran-launch-Build-stdout.txt new file mode 100644 index 0000000..3313e31 --- /dev/null +++ b/Tests/RunCMake/CompilerLauncher/Fortran-launch-Build-stdout.txt @@ -0,0 +1 @@ +.*-E env USED_LAUNCHER=1.* diff --git a/Tests/RunCMake/CompilerLauncher/Fortran-launch.cmake b/Tests/RunCMake/CompilerLauncher/Fortran-launch.cmake new file mode 100644 index 0000000..7e9a564 --- /dev/null +++ b/Tests/RunCMake/CompilerLauncher/Fortran-launch.cmake @@ -0,0 +1,3 @@ +set(CTEST_USE_LAUNCHERS 1) +include(CTestUseLaunchers) +include(Fortran.cmake) diff --git a/Tests/RunCMake/CompilerLauncher/Fortran.cmake b/Tests/RunCMake/CompilerLauncher/Fortran.cmake new file mode 100644 index 0000000..72cc03e --- /dev/null +++ b/Tests/RunCMake/CompilerLauncher/Fortran.cmake @@ -0,0 +1,4 @@ +enable_language(Fortran) +set(CMAKE_Fortran_COMPILER_LAUNCHER "${CMAKE_COMMAND};-E;env;USED_LAUNCHER=1") +set(CMAKE_VERBOSE_MAKEFILE TRUE) +add_executable(main main.F) diff --git a/Tests/RunCMake/CompilerLauncher/RunCMakeTest.cmake b/Tests/RunCMake/CompilerLauncher/RunCMakeTest.cmake index ab26512..bb8da03 100644 --- a/Tests/RunCMake/CompilerLauncher/RunCMakeTest.cmake +++ b/Tests/RunCMake/CompilerLauncher/RunCMakeTest.cmake @@ -19,6 +19,9 @@ set(langs C CXX) if(CMake_TEST_CUDA) list(APPEND langs CUDA) endif() +if(CMake_TEST_Fortran) + list(APPEND langs Fortran) +endif() foreach(lang ${langs}) run_compiler_launcher(${lang}) diff --git a/Tests/RunCMake/CompilerLauncher/main.F b/Tests/RunCMake/CompilerLauncher/main.F new file mode 100644 index 0000000..53ec0d1 --- /dev/null +++ b/Tests/RunCMake/CompilerLauncher/main.F @@ -0,0 +1,2 @@ + PROGRAM MAIN + END diff --git a/Tests/RunCMake/File_Generate/COMPILE_LANGUAGE-genex-result.txt b/Tests/RunCMake/File_Generate/COMPILE_LANGUAGE-genex-result.txt deleted file mode 100644 index 573541a..0000000 --- a/Tests/RunCMake/File_Generate/COMPILE_LANGUAGE-genex-result.txt +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/Tests/RunCMake/File_Generate/COMPILE_LANGUAGE-genex.cmake b/Tests/RunCMake/File_Generate/COMPILE_LANGUAGE-genex.cmake index 59ccf19..bead2af 100644 --- a/Tests/RunCMake/File_Generate/COMPILE_LANGUAGE-genex.cmake +++ b/Tests/RunCMake/File_Generate/COMPILE_LANGUAGE-genex.cmake @@ -1,12 +1,6 @@ - enable_language(CXX C) -add_library(empty empty.cpp empty.c) -target_compile_options(empty - PRIVATE LANG_IS_$<COMPILE_LANGUAGE> -) - file(GENERATE OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/opts-$<COMPILE_LANGUAGE>.txt - CONTENT "$<TARGET_PROPERTY:empty,COMPILE_OPTIONS>\n" + CONTENT "LANG_IS_$<COMPILE_LANGUAGE>\n" ) diff --git a/Tests/RunCMake/File_Generate/CarryPermissions-result.txt b/Tests/RunCMake/File_Generate/CarryPermissions-result.txt deleted file mode 100644 index 573541a..0000000 --- a/Tests/RunCMake/File_Generate/CarryPermissions-result.txt +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/Tests/RunCMake/File_Generate/GenerateSource-result.txt b/Tests/RunCMake/File_Generate/GenerateSource-result.txt deleted file mode 100644 index 573541a..0000000 --- a/Tests/RunCMake/File_Generate/GenerateSource-result.txt +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/Tests/RunCMake/File_Generate/OutputNameMatchesOtherSources-result.txt b/Tests/RunCMake/File_Generate/OutputNameMatchesOtherSources-result.txt deleted file mode 100644 index 573541a..0000000 --- a/Tests/RunCMake/File_Generate/OutputNameMatchesOtherSources-result.txt +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/Tests/RunCMake/File_Generate/ReRunCMake-result.txt b/Tests/RunCMake/File_Generate/ReRunCMake-result.txt deleted file mode 100644 index 573541a..0000000 --- a/Tests/RunCMake/File_Generate/ReRunCMake-result.txt +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/Tests/RunCMake/File_Generate/RunCMakeTest.cmake b/Tests/RunCMake/File_Generate/RunCMakeTest.cmake index b660463..616e210 100644 --- a/Tests/RunCMake/File_Generate/RunCMakeTest.cmake +++ b/Tests/RunCMake/File_Generate/RunCMakeTest.cmake @@ -21,15 +21,13 @@ if (NOT file_contents MATCHES "generated.cpp.rule") message(SEND_ERROR "Rule file not in target sources! ${file_contents}") endif() -if (NOT RunCMake_GENERATOR MATCHES "Visual Studio") - run_cmake(COMPILE_LANGUAGE-genex) - foreach(l CXX C) - file(READ "${RunCMake_BINARY_DIR}/COMPILE_LANGUAGE-genex-build/opts-${l}.txt" l_defs) - if (NOT l_defs STREQUAL "LANG_IS_${l}\n") - message(FATAL_ERROR "File content does not match: ${l_defs}") - endif() - endforeach() -endif() +run_cmake(COMPILE_LANGUAGE-genex) +foreach(l CXX C) + file(READ "${RunCMake_BINARY_DIR}/COMPILE_LANGUAGE-genex-build/opts-${l}.txt" l_defs) + if (NOT l_defs STREQUAL "LANG_IS_${l}\n") + message(FATAL_ERROR "File content does not match: ${l_defs}") + endif() +endforeach() set(timeformat "%Y%j%H%M%S") diff --git a/Tests/RunCMake/File_Generate/WriteIfDifferent-result.txt b/Tests/RunCMake/File_Generate/WriteIfDifferent-result.txt deleted file mode 100644 index 573541a..0000000 --- a/Tests/RunCMake/File_Generate/WriteIfDifferent-result.txt +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/Utilities/IWYU/mapping.imp b/Utilities/IWYU/mapping.imp index 3240edf..6477d59 100644 --- a/Utilities/IWYU/mapping.imp +++ b/Utilities/IWYU/mapping.imp @@ -52,11 +52,13 @@ # __decay_and_strip is used internally in the C++11 standard library. # IWYU does not classify it as internal and suggests to add <type_traits>. # To ignore it, we simply map it to a file that is included anyway. + # Use '-Xiwyu -v7' to see the fully qualified names that need this. # TODO: Can this be simplified with an @-expression? #{ symbol: [ "@std::__decay_and_strip<.*>::__type", private, "\"cmConfigure.h\"", public ] }, { symbol: [ "std::__decay_and_strip<cmCommand *&>::__type", private, "\"cmConfigure.h\"", public ] }, { symbol: [ "std::__decay_and_strip<cmGeneratorTarget *&>::__type", private, "\"cmConfigure.h\"", public ] }, { symbol: [ "std::__decay_and_strip<cmFindCommon::PathLabel &>::__type", private, "\"cmConfigure.h\"", public ] }, + { symbol: [ "std::__decay_and_strip<cmSearchPath>::__type", private, "\"cmConfigure.h\"", public ] }, { symbol: [ "std::__decay_and_strip<std::basic_string<char> &>::__type", private, "\"cmConfigure.h\"", public ] }, { symbol: [ "std::__decay_and_strip<const std::basic_string<char> &>::__type", private, "\"cmConfigure.h\"", public ] }, { symbol: [ "std::__decay_and_strip<cmFindPackageCommand::PathLabel &>::__type", private, "\"cmConfigure.h\"", public ] }, |