Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMake support #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
.vs/
out/
fart
45 changes: 45 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
cmake_minimum_required(VERSION 3.8.2)

project(Fart VERSION 1.0.0.0
DESCRIPTION "Find And Replace Text command line utility."
LANGUAGES C CXX)

set(libfart_target libfart)
set(fart_target fart)

list(APPEND libfart_source
fart_shared.c)

list(APPEND libfart_public_headers
fart_shared.h)

list(APPEND fart_source
wildmat.c
fart.cpp)

if(MSVC)
set(FART_FILEDESCRIPTION "Find And Replace Text command line utility")
set(FART_INTERNALNAME "${fart_target}")
set(FART_ORIGINALFILENAME "${fart_target}.exe")
set(FART_PRODUCTNAME "${fart_target}")
configure_file("version.rc.in" "version.rc" @ONLY)
list(APPEND fart_source
"${CMAKE_CURRENT_BINARY_DIR}/version.rc")
endif()

add_library(${libfart_target} ${libfart_source})
add_executable(${fart_target} ${fart_source})
target_include_directories(${libfart_target} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_include_directories(${fart_target} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
set_target_properties(${libfart_target} PROPERTIES
PUBLIC_HEADER "${libfart_public_headers}")
target_link_libraries(${fart_target} ${libfart_target})


install(TARGETS ${libfart_target}
PUBLIC_HEADER DESTINATION include
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
install(TARGETS ${fart_target}
LIBRARY DESTINATION bin
ARCHIVE DESTINATION bin)
65 changes: 65 additions & 0 deletions version.rc.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# if defined(UNDER_CE)
# include <winbase.h>
# else
# include <windows.h>
# endif

#define VER_FILEVERSION @PROJECT_VERSION_MAJOR@,@PROJECT_VERSION_MINOR@,@PROJECT_VERSION_PATCH@,@PROJECT_VERSION_TWEAK@
#define VER_FILEVERSION_STR "@PROJECT_VERSION_MAJOR@.@PROJECT_VERSION_MINOR@.@PROJECT_VERSION_PATCH@.@PROJECT_VERSION_TWEAK@\0"

#define VER_PRODUCTVERSION @PROJECT_VERSION_MAJOR@,@PROJECT_VERSION_MINOR@,0,0
#define VER_PRODUCTVERSION_STR "@PROJECT_VERSION_MAJOR@.@PROJECT_VERSION_MINOR@\0"

#define VER_COMPANYNAME_STR "@FART_COMPANYNAME@"
#define VER_FILEDESCRIPTION_STR "@FART_FILEDESCRIPTION@"
#define VER_INTERNALNAME_STR "@FART_INTERNALNAME@"
#define VER_LEGALCOPYRIGHT_STR "@FART_LEGALCOPYRIGHT@"
#define VER_ORIGINALFILENAME_STR "@FART_ORIGINALFILENAME@"
#define VER_PRODUCTNAME_STR "@FART_PRODUCTNAME@"

#ifndef DEBUG
#define VER_DEBUG 0
#else
#define VER_DEBUG VS_FF_DEBUG
#endif

#define VER_FILEFLAGS (VS_FF_PRIVATEBUILD|VS_FF_PRERELEASE|VER_DEBUG)

VS_VERSION_INFO VERSIONINFO
FILEVERSION VER_FILEVERSION
PRODUCTVERSION VER_PRODUCTVERSION
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
FILEFLAGS VER_FILEFLAGS
FILEOS VOS__WINDOWS32
FILETYPE VFT_APP
FILESUBTYPE VFT2_UNKNOWN
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904E4"
BEGIN
VALUE "CompanyName", VER_COMPANYNAME_STR
VALUE "FileDescription", VER_FILEDESCRIPTION_STR
VALUE "FileVersion", VER_FILEVERSION_STR
VALUE "InternalName", VER_INTERNALNAME_STR
VALUE "LegalCopyright", VER_LEGALCOPYRIGHT_STR
/* VALUE "LegalTrademarks1", VER_LEGALTRADEMARKS1_STR */
/* VALUE "LegalTrademarks2", VER_LEGALTRADEMARKS2_STR */
VALUE "OriginalFilename", VER_ORIGINALFILENAME_STR
VALUE "ProductName", VER_PRODUCTNAME_STR
VALUE "ProductVersion", VER_PRODUCTVERSION_STR
END
END

BLOCK "VarFileInfo"
BEGIN
/* The following line should only be modified for localized versions. */
/* It consists of any number of WORD,WORD pairs, with each pair */
/* describing a language,codepage combination supported by the file. */
/* */
/* For example, a file might have values "0x409,1252" indicating that it */
/* supports English language (0x409) in the Windows ANSI codepage (1252). */

VALUE "Translation", 0x409, 1252
END
END