summaryrefslogtreecommitdiff
path: root/src/CMakeLists.txt
AgeCommit message (Collapse)Author
2020-01-11Fix CMake generator expression checking for MSVCNick Wellnhofer
2020-01-05Move C_VISIBILITY_PRESET back to src/CMakeLists.txt.John MacFarlane
This reverts a change by @compnerd in commit b6ffaca93e2b539ec407aeb4fd588c7f9441e7a9. We don't want this for api_tests, as it triggers this warning: ``` CMake Warning (dev) at api_test/CMakeLists.txt:1 (add_executable): Policy CMP0063 is not set: Honor visibility properties for all target types. Run "cmake --help-policy CMP0063" for policy details. Use the cmake_policy command to set the policy and suppress this warning. Target "api_test" of type "EXECUTABLE" has the following visibility properties set for C: C_VISIBILITY_PRESET For compatibility CMake is not honoring them for this target. This warning is for project developers. Use -Wno-dev to suppress it. ```
2020-01-02build: add exports targets for build tree usageSaleem Abdulrasool
This enables the use of the export targets from the build tree to allow easy use of the CMark library in other projects. Resolves: #307
2020-01-02build: use target properties for include pathsSaleem Abdulrasool
This configures the target to setup the include paths publicly for the library targets in the build interface. This enables uses of the targets in the build tree without having to specify the include directories. This is particularly useful for use in the export targets, but also simplifies the rules for the API tests. The install interface does not need the include directories as `cmark.h` is installed into `include` which is a default include path.
2020-01-02build: reduce property computation in CMakeSaleem Abdulrasool
This reduces the work that CMake needs to do to configure the libraries by setting all the properties at once.
2020-01-02build: use `CMAKE_INCLUDE_CURRENT_DIRECTORY`Saleem Abdulrasool
This uses the CMake mechanism for including the current source and binary directories. This avoids the custom handling for this.
2020-01-02build: only include GNUInstallDirs onceSaleem Abdulrasool
Avoid including the utility once, which should avoid some unnecessary CMake checks, and reduces duplication.
2019-12-22build: cleanup CMake (#319)Saleem Abdulrasool
* build: inline a variable * build: use `LINKER_LANGUAGE` property for C++ runtime Rather than explicitly name the C++ runtime, use the `LINKER_LANGUAGE` property to use the driver to spell the C++ runtime appropriately. * build: use CMake to control C standard Rather than use compiler specific flags to control the language standard, indicate to CMake the desired standard. * build: use the correct variable These flags are being applied to the *C* compiler, check the C compiler, not the C++ compiler. * build: loosen the compiler check This loosens the compiler identifier check to enable matching AppleClang which is the identifier for the Xcode compiler. * build: hoist shared flags to top-level CMakeLists This hoists the common shared flags handling to the top-level CMakeLists from sub-layers. This prevents the duplication of the handling. * build: remove duplicated flags This is unnecessary, `/TP` is forced on all MSVC builds, no need to duplicate the flag for older versions. * build: loosen C compiler identifier check Loosen the check to a match rather than equality check, this allows it to match AppleClang which is the identifier for the Apple vended clang compiler part of Xcode. * build: use `add_compile_options` Use `add_compile_options` rather than modify `CMAKE_C_FLAGS`. The latter is meant to be only modified by the user, not the package developer. * build: hoist sanitizer flags to global state This moves the CMAKE_C_FLAGS handling to the top-level and uses `add_compile_options` rather than modifying the user controlled flags. * build: hoist `-fvisibilty` flags to top-level These are global settings, hoist them to the top level. * build: hoist the debug flag handling Use a generator expression and hoist the flag handling for the debug build. * build: hoist the profile flag handling This is a global flag, hoist it to the top level and use `add_compile_options` rather than modify the user controlled flags. * build: remove incorrect variable handling This seemed to be attempting to set the linker not the linker flags for the profile configuration. This variable is not used, do not set it. * build: remove unused CMake includes
2019-04-23Link executable with static or shared libraryNick Wellnhofer
If CMARK_STATIC is on (default), link the executable with the static library. This produces exactly the same result as compiling the library sources again and linking with the object files. If CMARK_STATIC is off, link the executable with the shared library. This wasn't supported before and should be the preferred way to package cmark on Linux distros. Building only a shared library and a statically linked executable isn't supported anymore but this doesn't seem useful.
2019-03-18Remove deprecated call to add_compiler_export_flags()Jonathan Müller
It is deprecated in CMake 3.0, the replacement is to set the CXX_VISIBILITY_PRESET (or in our case C_VISIBILITY_PRESET) and VISIBILITY_INLINES_HIDDEN properties of the target. We're already setting them by setting the CMake variables anyway, so the call can be removed.
2018-09-05build: only attempt to install MSVC system libraries on WindowsSaleem Abdulrasool
Newer versions of CMake attempt to query the system for information about the VS 2017 installation. Unfortunately, this query fails on non-Windows systems when cross-compiling: cmake_host_system_information does not recognize <key> VS_15_DIR CMake will not find these system libraries on non-Windows hosts anyways, and we were silencing the warnings, so simply omit the installation when cross-compiling to Windows.
2017-11-14Generate export header for static-only buildNick Wellnhofer
Fixes issue #247.
2017-10-19Include GNUInstallDirs in src/CMakeLists.txtNick Wellnhofer
Fixes installation error under some CMake versions, notably kalakris' CMake backport often used with Travis.
2017-10-12Fixed regression in install dest for static library.John MacFarlane
Due to a mistake, 0.28.1 installed libcmark.a into include/. Closes #238.
2017-10-10Don't use CMAKE_INSTALL_LIBDIR to create libcmark.pc.John MacFarlane
For some reason this wasn't getting set in processing libcmark.pc.in, and we were getting the wrong entry in libcmark.pc. (See #236) The new approach sets an internal libdir variable to lib${LIB_SUFFIX}. This variable is used both to set the install destination and in the libcmark.pc.in template. Closes #236. However, I'd welcome comments from @juhp who originally added CMAKE_INSTALL_LIBDIR in #185. I think that the new system should work fine with Fedora, since LIB_SUFFIX will be set appropriately, but some testing is in order.
2017-06-27Add Makefile target and harness to fuzz with libFuzzerPhil Turnbull
This can be run locally with `make libFuzzer` but the harness will be integrated into oss-fuzz for large-scale fuzzing.
2017-01-06Make shared and static libraries optionalAzamat H. Hackimov
Now you can enable/disable compilation and installation targets for shared and static libraries via -DCMARK_SHARED=ON/OFF and -DCMARK_STATIC=ON/OFF
2017-01-06Added support for built-in ${LIB_SUFFIX} featureAzamat H. Hackimov
Replaced ${LIB_INSTALL_DIR} option with built-in ${LIB_SUFFIX} for installing for 32/64-bit systems. Normally, CMake will set ${LIB_SUFFIX} automatically for required enviroment. If you have any issues with it, you can override this option with -DLIB_SUFFIX=64 or -DLIB_SUFFIX="" during configuration.
2017-01-03Revert "More sourcepos! (#169)"John MacFarlane
This reverts commit 9e643720ec903f3b448bd2589a0c02c2514805ae.
2016-12-20More sourcepos! (#169)Mathieu Duponchelle
* open_new_blocks: always create child before advancing offset * Source map * Extent's typology * In-depth python bindings
2016-11-24Remove redundant cmake_minimum_required.John MacFarlane
Closes #163, thanks to @kainjow.
2016-11-19Use VERSION_GREATER to clean up cmake version test.John MacFarlane
2016-11-19Put set_policy under cmake version test.John MacFarlane
Otherwise we get errors in older versions of cmake.
2016-11-18Set policy for CMP0063 to avoid a warning.John MacFarlane
See #162.
2016-11-09Fix CMAKE_C_VISIBILITY_PRESET for cmake versions greater than 1.8 (e.g. ↵Hugh Bellamy
3.6.2) (#162) This lets us build swift-cmark on Windows, using clang-cl This was an oversight: CMAKE_C_VISIBILITY_PRESET is only available on CMAKE 1.8 or greater. However, the current check doesn't work for a version such as CMAKE 3.6.2, for example ```bash mkdir "C:/Users/hughb/Documents/GitHub/my-swift/build/Ninja-DebugAssert/cmark-windows-amd64" pushd "C:/Users/hughb/Documents/GitHub/my-swift/build/Ninja-DebugAssert/cmark-windows-amd64" cmake -G Ninja -DCMAKE_C_COMPILER="C:/Program Files/LLVM/msbuild-bin/cl.exe" -DCMAKE_CXX_COMPILER="C:/Program Files/LLVM/msbuild-bin/cl.exe" -DCMAKE_CXX_FLAGS="-Xclang -std=c++14" "C:/Users/hughb/Documents/GitHub/my-swift/cmark" popd cmake --build "C:/Users/hughb/Documents/GitHub/my-swift/build/Ninja-DebugAssert/cmark-windows-amd64/" -- -j6 all ```
2016-06-27Change export install locationJonathan Müller
2016-06-27Export the targets on installationJonathan Müller
This allows using them in other cmake projects.
2016-03-12Compile in plain C mode with MSVC 12.0 or newerNick Wellnhofer
Under MSVC, we used to compile in C++ mode to get some C99 features like mixing declarations and code. With newer MSVC versions, it's possible to build in plain C mode.
2015-12-28Make LIB_INSTALL_DIR configurable.John MacFarlane
Closes #79. Thanks to Mathieu Bridon for the patch.
2015-12-24Removed obsolete TIMER macro.John MacFarlane
2015-12-19Removed bench.h and timing calls in main.cJohn MacFarlane
2015-12-04Install static library.John MacFarlane
Closes jgm/CommonMark#381.
2015-08-10Remove need to disable MSVC warning 4267Kevin Wojniak
2015-08-10Remove need to disable MSVC warning 4244Kevin Wojniak
2015-08-10Remove need to disable MSVC warning 4244Kevin Wojniak
2015-08-10Remove need to disable MSVC warning 4800Kevin Wojniak
2015-08-09Avoid name clash between Windows .pdb filesNick Wellnhofer
2015-07-25Removed cmark_strbuf_printf and cmark_strbuf_vprintf.John MacFarlane
These are no longer needed, and cause complications for MSVC. Also removed HAVE_VA_COPY and HAVE_C99_SNPRINTF feature tests.
2015-07-15Set POSITION_INDEPENDENT_CODE ON for static library.John MacFarlane
See discussion in #39.
2015-07-11Factored out common bits of rendering into separate render module.John MacFarlane
* Added render.c, render.h. * Moved common functions and definitions from latex.c and commonmark.c to render.c, render.h. * Added a wrapper, cmark_render, that creates a renderer given a character-escaper and a node renderer. Closes #63.
2015-07-11Removed dependence on debug.h.John MacFarlane
(It uses GNU extensions, and we don't need it anyway.)
2015-07-05Added LaTeX renderer.John MacFarlane
* New exported function in API: `cmark_render_latex`. * Added src/latex.hs. * Updated README and man page. * Closes #31.
2015-06-17Renamed entities.h -> entities.inc.John MacFarlane
Also tools/make_entities_h.py -> tools/make_entitis_inc.py.
2015-06-16Replace gperf-based entity lookup with binary tree lookup.John MacFarlane
The primary advantage is a big reduction in the size of the compiled library and executable (> 100K). There should be no measurable performance difference in normal documents. I detected a slight performance hit (around 5%) in a file containing 1,000,000 entities. * Removed `src/html_unescape.gperf` and `src/html_unescape.h`. * Added `src/entities.h` (generated by `tools/make_entities_h.py`). * Added binary tree lookup functions to `houdini_html_u.c`, and use the data in `src/entities.h`.
2015-05-31Merge pull request #45 from nwellnhof/windows_snprintfJohn MacFarlane
Cope with broken snprintf on Windows
2015-05-31Removed -pg from Debug build flags.John MacFarlane
Closes #47.
2015-05-29Cope with broken snprintf on WindowsNick Wellnhofer
On Windows, snprintf returns -1 if the output was truncated. Fall back to Windows-specific _scprintf.
2015-05-29Revert "Ubsan: add -fsanitize=undefined to link flags too."John MacFarlane
This reverts commit 678bdab4a4421e64f7c36991a098ae6db730140b. This commit led to two -fsanitized=undefined in the same linker invocation.
2015-05-29Ubsan: add -fsanitize=undefined to link flags too.John MacFarlane
2015-05-29Added Ubsan build target, to check for undefined behavior.John MacFarlane